Pass reference to func, as well as args, when pushing frame. (GH-31100)

This commit is contained in:
Mark Shannon 2022-02-03 18:36:28 +00:00 committed by GitHub
parent 2d080347d7
commit da4d4ec185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 29 deletions

View file

@ -109,6 +109,7 @@ _PyFrame_Clear(InterpreterFrame *frame)
Py_DECREF(frame->f_code);
}
/* Consumes reference to func */
InterpreterFrame *
_PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func)
{
@ -117,6 +118,7 @@ _PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func)
CALL_STAT_INC(frames_pushed);
InterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size);
if (new_frame == NULL) {
Py_DECREF(func);
return NULL;
}
_PyFrame_InitializeSpecials(new_frame, func, NULL, code->co_nlocalsplus);