summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.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 /Objects/frameobject.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 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 15da132..78f3894 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -784,6 +784,8 @@ _Py_IDENTIFIER(__builtins__);
static void
init_frame(InterpreterFrame *frame, PyFunctionObject *func, PyObject *locals)
{
+ /* _PyFrame_InitializeSpecials consumes reference to func */
+ Py_INCREF(func);
PyCodeObject *code = (PyCodeObject *)func->func_code;
_PyFrame_InitializeSpecials(frame, func, locals, code->co_nlocalsplus);
for (Py_ssize_t i = 0; i < code->co_nlocalsplus; i++) {