Skip to content
Prev Previous commit
Next Next commit
fix get_tools_for_instruction
  • Loading branch information
P403n1x87 committed Mar 20, 2026
commit 8fb54fa4f499aa4098526ee68ee2ac7e308613b4
12 changes: 10 additions & 2 deletions Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,10 +1104,18 @@ get_tools_for_instruction(PyCodeObject *code, PyInterpreterState *interp, int i,
}
assert(_PY_MONITORING_IS_UNGROUPED_EVENT(event));
CHECK(debug_check_sanity(interp, code));
if (code->_co_monitoring->tools) {
tools = code->_co_monitoring->tools[i];
if (PY_MONITORING_IS_INSTRUMENTED_EVENT(event)) {
/* Instrumented events use per-instruction tool bitmaps. */
if (code->_co_monitoring->tools) {
tools = code->_co_monitoring->tools[i];
}
else {
tools = code->_co_monitoring->active_monitors.tools[event];
}
}
else {
/* Non-instrumented local events are not tied to specific instructions;
* use the code-object-level active_monitors bitmap instead. */
tools = code->_co_monitoring->active_monitors.tools[event];
Comment thread
P403n1x87 marked this conversation as resolved.
}
return tools;
Expand Down
Loading