Skip to content

Commit

Permalink
When _PyOptimizer_BackEdge fails, restore next_instr
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gvanrossum committed Jul 6, 2023
1 parent d7df54b commit 1868f91
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 232 deletions.
1 change: 1 addition & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,7 @@ dummy_func(
frame = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer);
if (frame == NULL) {
frame = cframe.current_frame;
next_instr = frame->prev_instr + 1;

This comment has been minimized.

Copy link
@markshannon

markshannon Jul 6, 2023

Member

Could you move this into its own PR, so it doesn't get lost if we abandon this PR? (it is a draft)

goto error;
}
assert(frame == cframe.current_frame);
Expand Down
Loading

0 comments on commit 1868f91

Please sign in to comment.