@@ -67,7 +67,7 @@ typedef struct _PyInterpreterFrame {
67
67
_Py_CODEUNIT * instr_ptr ;
68
68
int stacktop ; /* Offset of TOS from localsplus */
69
69
/* The return_offset determines where a `RETURN` should go in the caller,
70
- * relative to `prev_instr`.
70
+ * relative to `prev_instr`/`instr_ptr` .
71
71
* It is only meaningful to the callee,
72
72
* so it needs to be set in any CALL (to a Python function)
73
73
* or SEND (to a coroutine or generator).
@@ -285,7 +285,7 @@ _PyFrame_PushUnchecked(PyThreadState *tstate, PyFunctionObject *func, int null_l
285
285
/* Pushes a trampoline frame without checking for space.
286
286
* Must be guarded by _PyThreadState_HasStackSpace() */
287
287
static inline _PyInterpreterFrame *
288
- _PyFrame_PushTrampolineUnchecked (PyThreadState * tstate , PyCodeObject * code , int stackdepth , int prev_instr , int instr_ptr_offset )
288
+ _PyFrame_PushTrampolineUnchecked (PyThreadState * tstate , PyCodeObject * code , int stackdepth , int prev_instr )
289
289
{
290
290
CALL_STAT_INC (frames_pushed );
291
291
_PyInterpreterFrame * frame = (_PyInterpreterFrame * )tstate -> datastack_top ;
@@ -301,7 +301,7 @@ _PyFrame_PushTrampolineUnchecked(PyThreadState *tstate, PyCodeObject *code, int
301
301
frame -> stacktop = code -> co_nlocalsplus + stackdepth ;
302
302
frame -> frame_obj = NULL ;
303
303
frame -> prev_instr = _PyCode_CODE (code ) + prev_instr ;
304
- frame -> instr_ptr = _PyCode_CODE (code ) + instr_ptr_offset ;
304
+ frame -> instr_ptr = _PyCode_CODE (code ) + prev_instr + 1 ;
305
305
frame -> owner = FRAME_OWNED_BY_THREAD ;
306
306
frame -> return_offset = 0 ;
307
307
return frame ;
0 commit comments