Skip to content
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

gh-108976: Make sure instrumentation line returns the correct opcode when instruction instrumentation is stripped #109043

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Sep 7, 2023

_Py_call_instrumentation_line curently tries to get the original opcode before executing the trace function. The opcode can be INSTRUMENT_INSTRUCTION if instruction event is set. However, the trace function/monitoring callbacks can turn off the instruction event inside the function, which would invalidate the orignal opcode.

line_data->original_opcode won't help in this case as it will still store INSTRUMENT_INSTRUCTION - it won't be refreshed. So, in this case, we use the opcode directly if INSTRUCTION event is turned off on the code object entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants