Skip to content

Commit b5553ab

Browse files
committed
break local == instrumented assumption
1 parent 01de359 commit b5553ab

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Include/cpython/monitoring.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ extern "C" {
2222
#define PY_MONITORING_EVENT_BRANCH_LEFT 8
2323
#define PY_MONITORING_EVENT_BRANCH_RIGHT 9
2424
#define PY_MONITORING_EVENT_STOP_ITERATION 10
25-
#define PY_MONITORING_EVENT_PY_UNWIND 11
2625

27-
// TODO: PY_UNWIND requires no instrumentation so this definition is not
28-
// entirely correct.
2926
#define PY_MONITORING_IS_INSTRUMENTED_EVENT(ev) \
30-
((ev) <= _PY_MONITORING_LOCAL_EVENTS)
27+
((ev) <= PY_MONITORING_EVENT_STOP_ITERATION)
28+
29+
#define PY_MONITORING_EVENT_PY_UNWIND 11
30+
31+
#define PY_MONITORING_IS_LOCAL_EVENT(ev) \
32+
((ev) < _PY_MONITORING_LOCAL_EVENTS)
3133

3234

3335
/* Other events, mainly exceptions */

Python/ceval.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,9 +2616,7 @@ monitor_unwind(PyThreadState *tstate,
26162616
_Py_CODEUNIT *instr)
26172617
{
26182618
if (no_tools_for_local_event(tstate, frame, PY_MONITORING_EVENT_PY_UNWIND)) {
2619-
if (no_tools_for_global_event(tstate, PY_MONITORING_EVENT_PY_UNWIND)) {
2620-
return;
2621-
}
2619+
return;
26222620
}
26232621
do_monitor_exc(tstate, frame, instr, PY_MONITORING_EVENT_PY_UNWIND);
26242622
}

Python/instrumentation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ get_tools_for_instruction(PyCodeObject *code, PyInterpreterState *interp, int i,
11021102
event == PY_MONITORING_EVENT_C_RETURN);
11031103
event = PY_MONITORING_EVENT_CALL;
11041104
}
1105-
if (PY_MONITORING_IS_INSTRUMENTED_EVENT(event)) {
1105+
if (PY_MONITORING_IS_LOCAL_EVENT(event)) {
11061106
CHECK(debug_check_sanity(interp, code));
11071107
if (code->_co_monitoring->tools) {
11081108
tools = code->_co_monitoring->tools[i];

0 commit comments

Comments
 (0)