Skip to content

Commit b240ff5

Browse files
Fidget-Spinnerdevdanzinchris-eibl
authored andcommitted
gh-140104: Set next_instr properly in the JIT during exceptions (GH-140233)
Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com> Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
1 parent c1bfd4c commit b240ff5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a bug with exception handling in the JIT. Patch by Ken Jin. Bug reported
2+
by Daniel Diniz.

Python/ceval_macros.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,9 @@ do { \
368368
frame = tstate->current_frame; \
369369
stack_pointer = _PyFrame_GetStackPointer(frame); \
370370
if (next_instr == NULL) { \
371-
next_instr = frame->instr_ptr; \
371+
/* gh-140104: The exception handler expects frame->instr_ptr
372+
to after this_instr, not this_instr! */ \
373+
next_instr = frame->instr_ptr + 1; \
372374
JUMP_TO_LABEL(error); \
373375
} \
374376
DISPATCH(); \

0 commit comments

Comments
 (0)