@@ -74,7 +74,7 @@ PyObject_Length(PyObject *o)
7474Py_ssize_t
7575_PyObject_LengthHint (PyObject * o , Py_ssize_t defaultvalue )
7676{
77- static PyObject * hintstrobj = NULL ;
77+ _Py_IDENTIFIER ( __length_hint__ ) ;
7878 PyObject * ro , * hintmeth ;
7979 Py_ssize_t rv ;
8080
@@ -89,7 +89,7 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
8989 }
9090
9191 /* try o.__length_hint__() */
92- hintmeth = _PyObject_LookupSpecial (o , "__length_hint__" , & hintstrobj );
92+ hintmeth = _PyObject_LookupSpecial (o , & PyId___length_hint__ );
9393 if (hintmeth == NULL ) {
9494 if (PyErr_Occurred ())
9595 return -1 ;
@@ -697,7 +697,7 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
697697 PyObject * meth ;
698698 PyObject * empty = NULL ;
699699 PyObject * result = NULL ;
700- static PyObject * format_cache = NULL ;
700+ _Py_IDENTIFIER ( __format__ ) ;
701701
702702 /* If no format_spec is provided, use an empty string */
703703 if (format_spec == NULL ) {
@@ -706,7 +706,7 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
706706 }
707707
708708 /* Find the (unbound!) __format__ method (a borrowed reference) */
709- meth = _PyObject_LookupSpecial (obj , "__format__" , & format_cache );
709+ meth = _PyObject_LookupSpecial (obj , & PyId___format__ );
710710 if (meth == NULL ) {
711711 if (!PyErr_Occurred ())
712712 PyErr_Format (PyExc_TypeError ,
@@ -2571,7 +2571,7 @@ recursive_isinstance(PyObject *inst, PyObject *cls)
25712571int
25722572PyObject_IsInstance (PyObject * inst , PyObject * cls )
25732573{
2574- static PyObject * name = NULL ;
2574+ _Py_IDENTIFIER ( __instancecheck__ ) ;
25752575 PyObject * checker ;
25762576
25772577 /* Quick test for an exact match */
@@ -2597,7 +2597,7 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
25972597 return r ;
25982598 }
25992599
2600- checker = _PyObject_LookupSpecial (cls , "__instancecheck__" , & name );
2600+ checker = _PyObject_LookupSpecial (cls , & PyId___instancecheck__ );
26012601 if (checker != NULL ) {
26022602 PyObject * res ;
26032603 int ok = -1 ;
@@ -2640,7 +2640,7 @@ recursive_issubclass(PyObject *derived, PyObject *cls)
26402640int
26412641PyObject_IsSubclass (PyObject * derived , PyObject * cls )
26422642{
2643- static PyObject * name = NULL ;
2643+ _Py_IDENTIFIER ( __subclasscheck__ ) ;
26442644 PyObject * checker ;
26452645
26462646 if (PyTuple_Check (cls )) {
@@ -2662,7 +2662,7 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
26622662 return r ;
26632663 }
26642664
2665- checker = _PyObject_LookupSpecial (cls , "__subclasscheck__" , & name );
2665+ checker = _PyObject_LookupSpecial (cls , & PyId___subclasscheck__ );
26662666 if (checker != NULL ) {
26672667 PyObject * res ;
26682668 int ok = -1 ;
0 commit comments