diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2024-07-16 19:17:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-16 19:17:47 (GMT) |
commit | e65cb4c6f01a687f451ad9db1600525e1c5832c4 (patch) | |
tree | 25c8ddaf86a982aa81fdbb4f3d9cdd9748dbf8a1 /Objects | |
parent | 162b41f57757c1df40eb377985e2e877fb0f0ea3 (diff) | |
download | cpython-e65cb4c6f01a687f451ad9db1600525e1c5832c4.zip cpython-e65cb4c6f01a687f451ad9db1600525e1c5832c4.tar.gz cpython-e65cb4c6f01a687f451ad9db1600525e1c5832c4.tar.bz2 |
gh-118934: Make PyEval_GetLocals return borrowed reference (#119769)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/frameobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 3dc9ff0..2ef3bea 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -1627,6 +1627,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; @@ -1638,6 +1639,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; } @@ -1650,6 +1652,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 */ _PyStackRef *locals = _PyFrame_GetLocalsArray(f->f_frame); @@ -1787,6 +1790,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; } |