diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst b/Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst new file mode 100644 index 00000000000..c30c21f034a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-09-14-20-15-57.gh-issue-107265.qHZL_6.rst @@ -0,0 +1 @@ +Deopt opcodes hidden by the executor when base opcode is needed diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 20e5dedb228..f662b8e354b 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -1505,7 +1505,7 @@ deopt_code(PyCodeObject *code, _Py_CODEUNIT *instructions) int opcode = _Py_GetBaseOpcode(code, i); if (opcode == ENTER_EXECUTOR) { _PyExecutorObject *exec = code->co_executors->executors[instructions[i].op.arg]; - opcode = exec->vm_data.opcode; + opcode = _PyOpcode_Deopt[exec->vm_data.opcode]; instructions[i].op.arg = exec->vm_data.oparg; } assert(opcode != ENTER_EXECUTOR); diff --git a/Python/instrumentation.c b/Python/instrumentation.c index df8943b1f9a..0b974f6133c 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -306,7 +306,7 @@ _PyInstruction_GetLength(PyCodeObject *code, int offset) 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; + opcode = _PyOpcode_Deopt[exec->vm_data.opcode]; } assert(opcode != ENTER_EXECUTOR);