]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-107082: Fix instruction size computation for ENTER_EXECUTOR (#107256)
authorGuido van Rossum <guido@python.org>
Tue, 25 Jul 2023 20:01:02 +0000 (13:01 -0700)
committerGitHub <noreply@github.com>
Tue, 25 Jul 2023 20:01:02 +0000 (20:01 +0000)
Co-authored-by: Victor Stinner <vstinner@python.org>
Python/instrumentation.c

index e1b62bb32ec8bdd0cf09687043233329e67a8927..c3515d2c5a3ad99c44a7270be7decbb693ba9df8 100644 (file)
@@ -276,6 +276,13 @@ _PyInstruction_GetLength(PyCodeObject *code, int offset)
     }
     assert(opcode != 0);
     assert(!is_instrumented(opcode));
+    if (opcode == ENTER_EXECUTOR) {
+        int exec_index = _PyCode_CODE(code)[offset].op.arg;
+        _PyExecutorObject *exec = code->co_executors->executors[exec_index];
+        opcode = exec->vm_data.opcode;
+
+    }
+    assert(opcode != ENTER_EXECUTOR);
     assert(opcode == _PyOpcode_Deopt[opcode]);
     return 1 + _PyOpcode_Caches[opcode];
 }