You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Instrumentation assertion failure when calling the registered handler explicitly #122247
On my mac M1 Sonoma (14.5), Python 3.13.0b4, I see this crash when registering an opcode monitor, calling the handler explicitly while it's enabled, and then restarting events. To reproduce:
importsysdefmymonitor(code, instruction_offset):
passtool_id=4sys.monitoring.use_tool_id(tool_id, "mytool")
sys.monitoring.register_callback(
tool_id,
sys.monitoring.events.INSTRUCTION,
mymonitor,
)
sys.monitoring.set_events(tool_id, sys.monitoring.events.INSTRUCTION)
mymonitor(None, 0) # call the *same* handler while it is registered sys.monitoring.restart_events()
Triggers an assertion failure (my minimal debugging suggests it's about some inconsistency with the "instrumentation_version"):
$ 3.13.0b4-debug/bin/python -X dev repro.py
Assertion failed: (debug_check_sanity(tstate->interp, code)), function _Py_call_instrumentation_instruction, file instrumentation.c, line 1347.
Fatal Python error: Aborted
Current thread 0x00000002064b0c00 (most recent call first):
File "/Users/phillipschanely/proj/CrossHair/repro.py", line 4 in mymonitor
File "/Users/phillipschanely/proj/CrossHair/repro.py", line 16 in <module>
zsh: abort /Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/bin/python -X dev
Activity
gaogaotiantian commentedon Jul 24, 2024
Confirmed on main. I'll take a look at it.
gh-122247: Move instruction instrumentation sanity check after tracin…
pythongh-122247: Move instruction instrumentation sanity check after …
[3.13] gh-122247: Move instruction instrumentation sanity check after…
pythongh-122247: Move instruction instrumentation sanity check after …