@@ -9357,17 +9357,17 @@ super_repr(PyObject *self)
93579357 su -> type ? su -> type -> tp_name : "NULL" );
93589358}
93599359
9360+ // if `method` is non-NULL, we are looking for a method descriptor,
9361+ // and setting `*method` to 1 means we found one.
93609362static PyObject *
93619363do_super_lookup (superobject * su , PyTypeObject * su_type , PyObject * su_obj ,
9362- PyTypeObject * su_obj_type , PyObject * name , int * meth_found )
9364+ PyTypeObject * su_obj_type , PyObject * name , int * method )
93639365{
9364- PyTypeObject * starttype ;
93659366 PyObject * mro , * res ;
93669367 Py_ssize_t i , n ;
93679368 int temp_su = 0 ;
93689369
9369- starttype = su_obj_type ;
9370- if (starttype == NULL )
9370+ if (su_obj_type == NULL )
93719371 goto skip ;
93729372
93739373 /* We want __class__ to return the class of the super object
@@ -9377,7 +9377,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
93779377 _PyUnicode_Equal (name , & _Py_ID (__class__ )))
93789378 goto skip ;
93799379
9380- mro = starttype -> tp_mro ;
9380+ mro = su_obj_type -> tp_mro ;
93819381 if (mro == NULL )
93829382 goto skip ;
93839383
@@ -9393,7 +9393,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
93939393 if (i >= n )
93949394 goto skip ;
93959395
9396- /* keep a strong reference to mro because starttype ->tp_mro can be
9396+ /* keep a strong reference to mro because su_obj_type ->tp_mro can be
93979397 replaced during PyDict_GetItemWithError(dict, name) */
93989398 Py_INCREF (mro );
93999399 do {
@@ -9404,8 +9404,8 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
94049404 res = PyDict_GetItemWithError (dict , name );
94059405 if (res != NULL ) {
94069406 Py_INCREF (res );
9407- if (meth_found && _PyType_HasFeature (Py_TYPE (res ), Py_TPFLAGS_METHOD_DESCRIPTOR )) {
9408- * meth_found = 1 ;
9407+ if (method && _PyType_HasFeature (Py_TYPE (res ), Py_TPFLAGS_METHOD_DESCRIPTOR )) {
9408+ * method = 1 ;
94099409 }
94109410 else {
94119411 descrgetfunc f = Py_TYPE (res )-> tp_descr_get ;
@@ -9414,8 +9414,8 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
94149414 res2 = f (res ,
94159415 /* Only pass 'obj' param if this is instance-mode super
94169416 (See SF ID #743627) */
9417- (su_obj == (PyObject * )starttype ) ? NULL : su_obj ,
9418- (PyObject * )starttype );
9417+ (su_obj == (PyObject * )su_obj_type ) ? NULL : su_obj ,
9418+ (PyObject * )su_obj_type );
94199419 Py_SETREF (res , res2 );
94209420 }
94219421 }
@@ -9509,13 +9509,13 @@ supercheck(PyTypeObject *type, PyObject *obj)
95099509}
95109510
95119511PyObject *
9512- _PySuper_Lookup (PyTypeObject * su_type , PyObject * su_obj , PyObject * name , int * meth_found )
9512+ _PySuper_Lookup (PyTypeObject * su_type , PyObject * su_obj , PyObject * name , int * method )
95139513{
95149514 PyTypeObject * su_obj_type = supercheck (su_type , su_obj );
95159515 if (su_obj_type == NULL ) {
95169516 return NULL ;
95179517 }
9518- PyObject * res = do_super_lookup (NULL , su_type , su_obj , su_obj_type , name , meth_found );
9518+ PyObject * res = do_super_lookup (NULL , su_type , su_obj , su_obj_type , name , method );
95199519 Py_DECREF (su_obj_type );
95209520 return res ;
95219521}
0 commit comments