summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-07-18 15:38:28 (GMT)
committerGitHub <noreply@github.com>2024-07-18 15:38:28 (GMT)
commit233ed46e6d2ba1d1f7d83a72ccf9aad9e628ede1 (patch)
tree01bc7b31b77979643876d79795899b740f155a6d /Objects/frameobject.c
parent98e7d447121f1637c76071548b019ba20a8b8a7a (diff)
downloadcpython-233ed46e6d2ba1d1f7d83a72ccf9aad9e628ede1.zip
cpython-233ed46e6d2ba1d1f7d83a72ccf9aad9e628ede1.tar.gz
cpython-233ed46e6d2ba1d1f7d83a72ccf9aad9e628ede1.tar.bz2
[3.13] gh-118934: Make PyEval_GetLocals return borrowed reference (GH-119769) (#121869)
gh-118934: Make PyEval_GetLocals return borrowed reference (GH-119769) (cherry picked from commit e65cb4c6f01a687f451ad9db1600525e1c5832c4) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com> Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 0465aaa..871ac82 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -1626,6 +1626,7 @@ frame_dealloc(PyFrameObject *f)
Py_CLEAR(f->f_back);
Py_CLEAR(f->f_trace);
Py_CLEAR(f->f_extra_locals);
+ Py_CLEAR(f->f_locals_cache);
PyObject_GC_Del(f);
Py_XDECREF(co);
Py_TRASHCAN_END;
@@ -1637,6 +1638,7 @@ frame_traverse(PyFrameObject *f, visitproc visit, void *arg)
Py_VISIT(f->f_back);
Py_VISIT(f->f_trace);
Py_VISIT(f->f_extra_locals);
+ Py_VISIT(f->f_locals_cache);
if (f->f_frame->owner != FRAME_OWNED_BY_FRAME_OBJECT) {
return 0;
}
@@ -1649,6 +1651,7 @@ frame_tp_clear(PyFrameObject *f)
{
Py_CLEAR(f->f_trace);
Py_CLEAR(f->f_extra_locals);
+ Py_CLEAR(f->f_locals_cache);
/* locals and stack */
PyObject **locals = _PyFrame_GetLocalsArray(f->f_frame);
@@ -1786,6 +1789,7 @@ _PyFrame_New_NoTrack(PyCodeObject *code)
f->f_trace_opcodes = 0;
f->f_lineno = 0;
f->f_extra_locals = NULL;
+ f->f_locals_cache = NULL;
return f;
}