diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-29 01:01:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 01:01:43 (GMT) |
commit | 4386b9045e5fe1151e65c2816264b5710000eb9f (patch) | |
tree | c1bcaffac32a12c8e8f52c1e621d18665b06ac6b /Objects | |
parent | 37af21b667a9f41437b5b8e451497d7725016df5 (diff) | |
download | cpython-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.c | 9 |
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) { |