@@ -9012,7 +9012,7 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
9012
9012
}
9013
9013
9014
9014
static int
9015
- super_init_without_args (PyFrameObject * f , PyCodeObject * co ,
9015
+ super_init_without_args (InterpreterFrame * cframe , PyCodeObject * co ,
9016
9016
PyTypeObject * * type_p , PyObject * * obj_p )
9017
9017
{
9018
9018
if (co -> co_argcount == 0 ) {
@@ -9021,13 +9021,13 @@ super_init_without_args(PyFrameObject *f, PyCodeObject *co,
9021
9021
return -1 ;
9022
9022
}
9023
9023
9024
- assert (f -> f_frame -> f_code -> co_nlocalsplus > 0 );
9025
- PyObject * firstarg = _PyFrame_GetLocalsArray (f -> f_frame )[0 ];
9024
+ assert (cframe -> f_code -> co_nlocalsplus > 0 );
9025
+ PyObject * firstarg = _PyFrame_GetLocalsArray (cframe )[0 ];
9026
9026
// The first argument might be a cell.
9027
9027
if (firstarg != NULL && (_PyLocals_GetKind (co -> co_localspluskinds , 0 ) & CO_FAST_CELL )) {
9028
9028
// "firstarg" is a cell here unless (very unlikely) super()
9029
9029
// was called from the C-API before the first MAKE_CELL op.
9030
- if (f -> f_frame -> f_lasti >= 0 ) {
9030
+ if (cframe -> f_lasti >= 0 ) {
9031
9031
assert (_Py_OPCODE (* co -> co_firstinstr ) == MAKE_CELL || _Py_OPCODE (* co -> co_firstinstr ) == COPY_FREE_VARS );
9032
9032
assert (PyCell_Check (firstarg ));
9033
9033
firstarg = PyCell_GET (firstarg );
@@ -9047,7 +9047,7 @@ super_init_without_args(PyFrameObject *f, PyCodeObject *co,
9047
9047
PyObject * name = PyTuple_GET_ITEM (co -> co_localsplusnames , i );
9048
9048
assert (PyUnicode_Check (name ));
9049
9049
if (_PyUnicode_EqualToASCIIId (name , & PyId___class__ )) {
9050
- PyObject * cell = _PyFrame_GetLocalsArray (f -> f_frame )[i ];
9050
+ PyObject * cell = _PyFrame_GetLocalsArray (cframe )[i ];
9051
9051
if (cell == NULL || !PyCell_Check (cell )) {
9052
9052
PyErr_SetString (PyExc_RuntimeError ,
9053
9053
"super(): bad __class__ cell" );
@@ -9096,17 +9096,13 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
9096
9096
/* Call super(), without args -- fill in from __class__
9097
9097
and first local variable on the stack. */
9098
9098
PyThreadState * tstate = _PyThreadState_GET ();
9099
- PyFrameObject * frame = PyThreadState_GetFrame ( tstate ) ;
9100
- if (frame == NULL ) {
9099
+ InterpreterFrame * cframe = tstate -> cframe -> current_frame ;
9100
+ if (cframe == NULL ) {
9101
9101
PyErr_SetString (PyExc_RuntimeError ,
9102
9102
"super(): no current frame" );
9103
9103
return -1 ;
9104
9104
}
9105
-
9106
- PyCodeObject * code = PyFrame_GetCode (frame );
9107
- int res = super_init_without_args (frame , code , & type , & obj );
9108
- Py_DECREF (frame );
9109
- Py_DECREF (code );
9105
+ int res = super_init_without_args (cframe , cframe -> f_code , & type , & obj );
9110
9106
9111
9107
if (res < 0 ) {
9112
9108
return -1 ;
0 commit comments