Skip to content

Commit 1a3e828

Browse files
committed
break local == instrumented assumption
1 parent 07a26bd commit 1a3e828

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
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/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)