Skip to content

Commit 1868f91

Browse files
committed
When _PyOptimizer_BackEdge fails, restore next_instr
This fixes a nasty bug in exception handling. Apparently some part of the computation that determines where the exception handler is uses next_instr, which was pointing at the JUMP_BACKWARD instruction instead of where the error was occurring.
1 parent d7df54b commit 1868f91

File tree

3 files changed

+235
-232
lines changed

3 files changed

+235
-232
lines changed

Python/bytecodes.c

+1
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,7 @@ dummy_func(
22342234
frame = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer);
22352235
if (frame == NULL) {
22362236
frame = cframe.current_frame;
2237+
next_instr = frame->prev_instr + 1;
22372238
goto error;
22382239
}
22392240
assert(frame == cframe.current_frame);

0 commit comments

Comments
 (0)