Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
GH-103082: Filter LINE events in VM, to simplify tool implementation.#104387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
4190fe76e8c98fcc62dcb54185801da7272e76f241b8d6799f9cf3dbFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2867,6 +2867,5 @@ def func(arg = 1): | ||
| sys.settrace(None) | ||
| if __name__ == "__main__": | ||
| unittest.main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Change behavior of ``sys.monitoring.events.LINE`` events in | ||
| ``sys.monitoring``: Line events now occur when a new line is reached | ||
| dynamically, instead of using a static approximation, as before. This makes | ||
| the behavior very similar to that of "line" events in ``sys.settrace``. This | ||
| should ease porting of tools from 3.11 to 3.12. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -775,6 +775,41 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | ||
| #include "generated_cases.c.h" | ||
| /* INSTRUMENTED_LINE has to be here, rather than in bytecodes.c, | ||
| * because it needs to capture frame->prev_instr before it is updated, | ||
| * as happens in the standard instruction prologue. | ||
| */ | ||
| #if USE_COMPUTED_GOTOS | ||
| TARGET_INSTRUMENTED_LINE: | ||
| #else | ||
| case INSTRUMENTED_LINE: | ||
| #endif | ||
| { | ||
| _Py_CODEUNIT *prev = frame->prev_instr; | ||
markshannon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| _Py_CODEUNIT *here = frame->prev_instr = next_instr; | ||
| _PyFrame_SetStackPointer(frame, stack_pointer); | ||
| int original_opcode = _Py_call_instrumentation_line( | ||
| tstate, frame, here, prev); | ||
| stack_pointer = _PyFrame_GetStackPointer(frame); | ||
| if (original_opcode < 0) { | ||
| next_instr = here+1; | ||
| goto error; | ||
| } | ||
| next_instr = frame->prev_instr; | ||
| if (next_instr != here) { | ||
| DISPATCH(); | ||
| } | ||
| if (_PyOpcode_Caches[original_opcode]) { | ||
| _PyBinaryOpCache *cache = (_PyBinaryOpCache *)(next_instr+1); | ||
| /* Prevent the underlying instruction from specializing | ||
| * and overwriting the instrumentation. */ | ||
| INCREMENT_ADAPTIVE_COUNTER(cache->counter); | ||
markshannon marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| opcode = original_opcode; | ||
| DISPATCH_GOTO(); | ||
| } | ||
| #if USE_COMPUTED_GOTOS | ||
| _unknown_opcode: | ||
| #else | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.