@@ -144,8 +144,9 @@ static inline void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *
144144static inline void
145145_PyFrame_Initialize (
146146 _PyInterpreterFrame * frame , PyFunctionObject * func ,
147- PyObject * locals , PyCodeObject * code , int null_locals_from )
147+ PyObject * locals , PyCodeObject * code , int null_locals_from , _PyInterpreterFrame * previous )
148148{
149+ frame -> previous = previous ;
149150 frame -> f_funcobj = (PyObject * )func ;
150151 frame -> f_executable = Py_NewRef (code );
151152 frame -> f_builtins = func -> func_builtins ;
@@ -298,26 +299,27 @@ PyAPI_FUNC(void) _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFr
298299 * Must be guarded by _PyThreadState_HasStackSpace()
299300 * Consumes reference to func. */
300301static inline _PyInterpreterFrame *
301- _PyFrame_PushUnchecked (PyThreadState * tstate , PyFunctionObject * func , int null_locals_from )
302+ _PyFrame_PushUnchecked (PyThreadState * tstate , PyFunctionObject * func , int null_locals_from , _PyInterpreterFrame * previous )
302303{
303304 CALL_STAT_INC (frames_pushed );
304305 PyCodeObject * code = (PyCodeObject * )func -> func_code ;
305306 _PyInterpreterFrame * new_frame = (_PyInterpreterFrame * )tstate -> datastack_top ;
306307 tstate -> datastack_top += code -> co_framesize ;
307308 assert (tstate -> datastack_top < tstate -> datastack_limit );
308- _PyFrame_Initialize (new_frame , func , NULL , code , null_locals_from );
309+ _PyFrame_Initialize (new_frame , func , NULL , code , null_locals_from , previous );
309310 return new_frame ;
310311}
311312
312313/* Pushes a trampoline frame without checking for space.
313314 * Must be guarded by _PyThreadState_HasStackSpace() */
314315static inline _PyInterpreterFrame *
315- _PyFrame_PushTrampolineUnchecked (PyThreadState * tstate , PyCodeObject * code , int stackdepth )
316+ _PyFrame_PushTrampolineUnchecked (PyThreadState * tstate , PyCodeObject * code , int stackdepth , _PyInterpreterFrame * previous )
316317{
317318 CALL_STAT_INC (frames_pushed );
318319 _PyInterpreterFrame * frame = (_PyInterpreterFrame * )tstate -> datastack_top ;
319320 tstate -> datastack_top += code -> co_framesize ;
320321 assert (tstate -> datastack_top < tstate -> datastack_limit );
322+ frame -> previous = previous ;
321323 frame -> f_funcobj = Py_None ;
322324 frame -> f_executable = Py_NewRef (code );
323325#ifdef Py_DEBUG
@@ -344,7 +346,8 @@ _PyFrame_PushTrampolineUnchecked(PyThreadState *tstate, PyCodeObject *code, int
344346PyAPI_FUNC (_PyInterpreterFrame * )
345347_PyEvalFramePushAndInit (PyThreadState * tstate , PyFunctionObject * func ,
346348 PyObject * locals , _PyStackRef const * args ,
347- size_t argcount , PyObject * kwnames );
349+ size_t argcount , PyObject * kwnames ,
350+ _PyInterpreterFrame * previous );
348351
349352#ifdef __cplusplus
350353}
0 commit comments