mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)
The PyThreadState_GetFrame() function now returns a strong reference to the frame.
This commit is contained in:
parent
37af21b667
commit
4386b9045e
7 changed files with 26 additions and 20 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue