@@ -144,8 +144,9 @@ static inline void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *
144
144
static inline void
145
145
_PyFrame_Initialize (
146
146
_PyInterpreterFrame * frame , PyFunctionObject * func ,
147
- PyObject * locals , PyCodeObject * code , int null_locals_from )
147
+ PyObject * locals , PyCodeObject * code , int null_locals_from , _PyInterpreterFrame * previous )
148
148
{
149
+ frame -> previous = previous ;
149
150
frame -> f_funcobj = (PyObject * )func ;
150
151
frame -> f_executable = Py_NewRef (code );
151
152
frame -> f_builtins = func -> func_builtins ;
@@ -298,26 +299,27 @@ PyAPI_FUNC(void) _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFr
298
299
* Must be guarded by _PyThreadState_HasStackSpace()
299
300
* Consumes reference to func. */
300
301
static 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 )
302
303
{
303
304
CALL_STAT_INC (frames_pushed );
304
305
PyCodeObject * code = (PyCodeObject * )func -> func_code ;
305
306
_PyInterpreterFrame * new_frame = (_PyInterpreterFrame * )tstate -> datastack_top ;
306
307
tstate -> datastack_top += code -> co_framesize ;
307
308
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 );
309
310
return new_frame ;
310
311
}
311
312
312
313
/* Pushes a trampoline frame without checking for space.
313
314
* Must be guarded by _PyThreadState_HasStackSpace() */
314
315
static inline _PyInterpreterFrame *
315
- _PyFrame_PushTrampolineUnchecked (PyThreadState * tstate , PyCodeObject * code , int stackdepth )
316
+ _PyFrame_PushTrampolineUnchecked (PyThreadState * tstate , PyCodeObject * code , int stackdepth , _PyInterpreterFrame * previous )
316
317
{
317
318
CALL_STAT_INC (frames_pushed );
318
319
_PyInterpreterFrame * frame = (_PyInterpreterFrame * )tstate -> datastack_top ;
319
320
tstate -> datastack_top += code -> co_framesize ;
320
321
assert (tstate -> datastack_top < tstate -> datastack_limit );
322
+ frame -> previous = previous ;
321
323
frame -> f_funcobj = Py_None ;
322
324
frame -> f_executable = Py_NewRef (code );
323
325
#ifdef Py_DEBUG
@@ -344,7 +346,8 @@ _PyFrame_PushTrampolineUnchecked(PyThreadState *tstate, PyCodeObject *code, int
344
346
PyAPI_FUNC (_PyInterpreterFrame * )
345
347
_PyEvalFramePushAndInit (PyThreadState * tstate , PyFunctionObject * func ,
346
348
PyObject * locals , _PyStackRef const * args ,
347
- size_t argcount , PyObject * kwnames );
349
+ size_t argcount , PyObject * kwnames ,
350
+ _PyInterpreterFrame * previous );
348
351
349
352
#ifdef __cplusplus
350
353
}
0 commit comments