From 93eda40971cd5ef97c7414bd77c391d9833b3f2b Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Wed, 3 Jan 2024 07:09:02 -0800 Subject: [PATCH] Fix broken recovery from invalid executors --- Python/bytecodes.c | 3 ++- Python/generated_cases.c.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 2eeeac53e1dd7e..e1a6a256fbdf96 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2378,11 +2378,12 @@ dummy_func( stack_pointer = _PyFrame_GetStackPointer(frame); } else { + code->co_executors->executors[oparg & 255] = NULL; opcode = this_instr->op.code = executor->vm_data.opcode; this_instr->op.arg = executor->vm_data.oparg; oparg = (oparg & (~255)) | executor->vm_data.oparg; - code->co_executors->executors[oparg&255] = NULL; Py_DECREF(executor); + next_instr = this_instr; DISPATCH_GOTO(); } } diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 99fd169ca4fec3..8226d827cde514 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2392,11 +2392,12 @@ stack_pointer = _PyFrame_GetStackPointer(frame); } else { + code->co_executors->executors[oparg & 255] = NULL; opcode = this_instr->op.code = executor->vm_data.opcode; this_instr->op.arg = executor->vm_data.oparg; oparg = (oparg & (~255)) | executor->vm_data.oparg; - code->co_executors->executors[oparg&255] = NULL; Py_DECREF(executor); + next_instr = this_instr; DISPATCH_GOTO(); } DISPATCH();