@@ -376,7 +376,9 @@ do { \
376376 frame = tstate -> current_frame ; \
377377 stack_pointer = _PyFrame_GetStackPointer (frame ); \
378378 if (next_instr == NULL ) { \
379- next_instr = frame -> instr_ptr ; \
379+ /* gh-140104: The exception handler expects frame->instr_ptr
380+ to after this_instr, not this_instr! */ \
381+ next_instr = frame -> instr_ptr + 1 ; \
380382 JUMP_TO_LABEL (error ); \
381383 } \
382384 DISPATCH (); \
@@ -393,6 +395,7 @@ do { \
393395} while (0)
394396#endif
395397
398+ #ifdef _Py_JIT
396399#define GOTO_TIER_ONE (TARGET ) \
397400 do \
398401 { \
@@ -409,6 +412,26 @@ do { \
409412 } \
410413 DISPATCH(); \
411414 } while (0)
415+ #else
416+ #define GOTO_TIER_ONE (TARGET ) \
417+ do \
418+ { \
419+ tstate->current_executor = NULL; \
420+ next_instr = (TARGET); \
421+ assert(tstate->current_executor == NULL); \
422+ OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); \
423+ _PyFrame_SetStackPointer(frame, stack_pointer); \
424+ stack_pointer = _PyFrame_GetStackPointer(frame); \
425+ if (next_instr == NULL) \
426+ { \
427+ /* gh-140104: The exception handler expects frame->instr_ptr
428+ to after this_instr, not this_instr! */ \
429+ next_instr = frame -> instr_ptr + 1 ; \
430+ goto error ; \
431+ } \
432+ DISPATCH (); \
433+ } while (0 )
434+ #endif
412435
413436#define CURRENT_OPARG () (next_uop[-1].oparg)
414437#define CURRENT_OPERAND0 () (next_uop[-1].operand0)
0 commit comments