summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-29 01:01:43 (GMT)
committerGitHub <noreply@github.com>2020-04-29 01:01:43 (GMT)
commit4386b9045e5fe1151e65c2816264b5710000eb9f (patch)
treec1bcaffac32a12c8e8f52c1e621d18665b06ac6b /Objects
parent37af21b667a9f41437b5b8e451497d7725016df5 (diff)
downloadcpython-4386b9045e5fe1151e65c2816264b5710000eb9f.zip
cpython-4386b9045e5fe1151e65c2816264b5710000eb9f.tar.gz
cpython-4386b9045e5fe1151e65c2816264b5710000eb9f.tar.bz2
bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)
The PyThreadState_GetFrame() function now returns a strong reference to the frame.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 7ba51e3..c2ddc16 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -8108,15 +8108,16 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
/* Call super(), without args -- fill in from __class__
and first local variable on the stack. */
PyThreadState *tstate = _PyThreadState_GET();
- PyFrameObject *f = PyThreadState_GetFrame(tstate);
- if (f == NULL) {
+ PyFrameObject *frame = PyThreadState_GetFrame(tstate);
+ if (frame == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"super(): no current frame");
return -1;
}
- PyCodeObject *code = PyFrame_GetCode(f);
- int res = super_init_without_args(f, code, &type, &obj);
+ PyCodeObject *code = PyFrame_GetCode(frame);
+ int res = super_init_without_args(frame, code, &type, &obj);
+ Py_DECREF(frame);
Py_DECREF(code);
if (res < 0) {