mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)
This commit is contained in:
parent
5e8c691594
commit
8852ad4208
9 changed files with 35 additions and 26 deletions
|
@ -8031,7 +8031,6 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
/* Call super(), without args -- fill in from __class__
|
||||
and first local variable on the stack. */
|
||||
PyFrameObject *f;
|
||||
PyCodeObject *co;
|
||||
Py_ssize_t i, n;
|
||||
f = PyThreadState_GetFrame(_PyThreadState_GET());
|
||||
if (f == NULL) {
|
||||
|
@ -8039,7 +8038,8 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
"super(): no current frame");
|
||||
return -1;
|
||||
}
|
||||
co = PyFrame_GetCode(f);
|
||||
PyCodeObject *co = PyFrame_GetCode(f);
|
||||
Py_DECREF(co); // use a borrowed reference
|
||||
if (co->co_argcount == 0) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"super(): no arguments");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue