]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Make RESUME monitoring more readable and robust (GH-142136)
authorGabriele N. Tornetta <P403n1x87@users.noreply.github.com>
Tue, 16 Dec 2025 16:23:27 +0000 (16:23 +0000)
committerGitHub <noreply@github.com>
Tue, 16 Dec 2025 16:23:27 +0000 (16:23 +0000)
Python/bytecodes.c
Python/generated_cases.c.h

index 0dbfe962684e208bcad773710fc704ea94e5a016..391fa8ea2a94eca945de3f85fa67bb5a7ad1a330 100644 (file)
@@ -240,7 +240,7 @@ dummy_func(
 
         op(_MONITOR_RESUME, (--)) {
             int err = _Py_call_instrumentation(
-                    tstate, oparg > 0, frame, this_instr);
+                    tstate, oparg == 0 ? PY_MONITORING_EVENT_PY_START : PY_MONITORING_EVENT_PY_RESUME, frame, this_instr);
             ERROR_IF(err);
             if (frame->instr_ptr != this_instr) {
                 /* Instrumentation has jumped */
index 2811a2ec8ac82dd7a9dc0c6a3d6112578c6c015f..94846d718308a5da407f28b3d2d1ab9cb3a078d3 100644 (file)
             {
                 _PyFrame_SetStackPointer(frame, stack_pointer);
                 int err = _Py_call_instrumentation(
-                    tstate, oparg > 0, frame, this_instr);
+                    tstate, oparg == 0 ? PY_MONITORING_EVENT_PY_START : PY_MONITORING_EVENT_PY_RESUME, frame, this_instr);
                 stack_pointer = _PyFrame_GetStackPointer(frame);
                 if (err) {
                     JUMP_TO_LABEL(error);