@@ -107,7 +107,7 @@ static bool _CPy_IsSafeMetaClass(PyTypeObject *metaclass) {
107107 // manage to work with TypingMeta and its friends.
108108 if (metaclass == & PyType_Type )
109109 return true;
110- PyObject * module = PyObject_GetAttrString ((PyObject * )metaclass , " __module__" );
110+ PyObject * module = PyObject_GetAttr ((PyObject * )metaclass , mypyc_interned_str . __module__ );
111111 if (!module ) {
112112 PyErr_Clear ();
113113 return false;
@@ -242,7 +242,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
242242 sizeof (PyTypeObject ) - sizeof (PyVarObject ));
243243
244244 if (bases != orig_bases ) {
245- if (PyObject_SetAttrString ((PyObject * )t , " __orig_bases__" , orig_bases ) < 0 )
245+ if (PyObject_SetAttr ((PyObject * )t , mypyc_interned_str . __orig_bases__ , orig_bases ) < 0 )
246246 goto error ;
247247 }
248248
@@ -285,7 +285,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
285285
286286 // Reject anything that would give us a nontrivial __slots__,
287287 // because the layout will conflict
288- slots = PyObject_GetAttrString ((PyObject * )t , " __slots__" );
288+ slots = PyObject_GetAttr ((PyObject * )t , mypyc_interned_str . __slots__ );
289289 if (slots ) {
290290 // don't fail on an empty __slots__
291291 int is_true = PyObject_IsTrue (slots );
@@ -298,7 +298,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
298298 PyErr_Clear ();
299299 }
300300
301- if (PyObject_SetAttrString ((PyObject * )t , " __module__" , modname ) < 0 )
301+ if (PyObject_SetAttr ((PyObject * )t , mypyc_interned_str . __module__ , modname ) < 0 )
302302 goto error ;
303303
304304 if (init_subclass ((PyTypeObject * )t , NULL ))
@@ -458,7 +458,7 @@ CPyPickle_GetState(PyObject *obj)
458458{
459459 PyObject * attrs = NULL , * state = NULL ;
460460
461- attrs = PyObject_GetAttrString ((PyObject * )Py_TYPE (obj ), " __mypyc_attrs__" );
461+ attrs = PyObject_GetAttr ((PyObject * )Py_TYPE (obj ), mypyc_interned_str . __mypyc_attrs__ );
462462 if (!attrs ) {
463463 goto fail ;
464464 }
@@ -734,7 +734,7 @@ int CPyStatics_Initialize(PyObject **statics,
734734// Call super(type(self), self)
735735PyObject *
736736CPy_Super (PyObject * builtins , PyObject * self ) {
737- PyObject * super_type = PyObject_GetAttrString (builtins , " super" );
737+ PyObject * super_type = PyObject_GetAttr (builtins , mypyc_interned_str . super );
738738 if (!super_type )
739739 return NULL ;
740740 PyObject * result = PyObject_CallFunctionObjArgs (
@@ -889,7 +889,7 @@ CPy_CallReverseOpMethod(PyObject *left,
889889PyObject * CPySingledispatch_RegisterFunction (PyObject * singledispatch_func ,
890890 PyObject * cls ,
891891 PyObject * func ) {
892- PyObject * registry = PyObject_GetAttrString (singledispatch_func , " registry" );
892+ PyObject * registry = PyObject_GetAttr (singledispatch_func , mypyc_interned_str . registry );
893893 PyObject * register_func = NULL ;
894894 PyObject * typing = NULL ;
895895 PyObject * get_type_hints = NULL ;
@@ -902,7 +902,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,
902902 // passed a class
903903 // bind cls to the first argument so that register gets called again with both the
904904 // class and the function
905- register_func = PyObject_GetAttrString (singledispatch_func , "register" );
905+ register_func = PyObject_GetAttr (singledispatch_func , mypyc_interned_str . register_ );
906906 if (register_func == NULL ) goto fail ;
907907 return PyMethod_New (register_func , cls );
908908 }
@@ -923,7 +923,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,
923923 func = cls ;
924924 typing = PyImport_ImportModule ("typing" );
925925 if (typing == NULL ) goto fail ;
926- get_type_hints = PyObject_GetAttrString (typing , " get_type_hints" );
926+ get_type_hints = PyObject_GetAttr (typing , mypyc_interned_str . get_type_hints );
927927
928928 type_hints = PyObject_CallOneArg (get_type_hints , func );
929929 PyObject * argname ;
@@ -944,7 +944,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,
944944 }
945945
946946 // clear the cache so we consider the newly added function when dispatching
947- PyObject * dispatch_cache = PyObject_GetAttrString (singledispatch_func , " dispatch_cache" );
947+ PyObject * dispatch_cache = PyObject_GetAttr (singledispatch_func , mypyc_interned_str . dispatch_cache );
948948 if (dispatch_cache == NULL ) goto fail ;
949949 PyDict_Clear (dispatch_cache );
950950
0 commit comments