summaryrefslogtreecommitdiffstats
path: root/Python/frame.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-02-03 18:36:28 (GMT)
committerGitHub <noreply@github.com>2022-02-03 18:36:28 (GMT)
commitda4d4ec1851714bb56a5e8d0c1cd5bf9842b4cee (patch)
tree0a59b7362a584322ba0042f411b28555353b4a67 /Python/frame.c
parent2d080347d74078a55c47715d232d1ab8dc8cd603 (diff)
downloadcpython-da4d4ec1851714bb56a5e8d0c1cd5bf9842b4cee.zip
cpython-da4d4ec1851714bb56a5e8d0c1cd5bf9842b4cee.tar.gz
cpython-da4d4ec1851714bb56a5e8d0c1cd5bf9842b4cee.tar.bz2
Pass reference to func, as well as args, when pushing frame. (GH-31100)
Diffstat (limited to 'Python/frame.c')
-rw-r--r--Python/frame.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/frame.c b/Python/frame.c
index ca7c5f9..76697cf 100644
--- a/Python/frame.c
+++ b/Python/frame.c
@@ -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);