@@ -109,7 +109,7 @@ static bool _CPy_IsSafeMetaClass(PyTypeObject *metaclass) {
109109 // manage to work with TypingMeta and its friends.
110110 if (metaclass == & PyType_Type )
111111 return true;
112- PyObject * module = PyObject_GetAttrString ((PyObject * )metaclass , " __module__" );
112+ PyObject * module = PyObject_GetAttr ((PyObject * )metaclass , mypyc_interned_str . __module__ );
113113 if (!module ) {
114114 PyErr_Clear ();
115115 return false;
@@ -244,7 +244,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
244244 sizeof (PyTypeObject ) - sizeof (PyVarObject ));
245245
246246 if (bases != orig_bases ) {
247- if (PyObject_SetAttrString ((PyObject * )t , " __orig_bases__" , orig_bases ) < 0 )
247+ if (PyObject_SetAttr ((PyObject * )t , mypyc_interned_str . __orig_bases__ , orig_bases ) < 0 )
248248 goto error ;
249249 }
250250
@@ -287,7 +287,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
287287
288288 // Reject anything that would give us a nontrivial __slots__,
289289 // because the layout will conflict
290- slots = PyObject_GetAttrString ((PyObject * )t , " __slots__" );
290+ slots = PyObject_GetAttr ((PyObject * )t , mypyc_interned_str . __slots__ );
291291 if (slots ) {
292292 // don't fail on an empty __slots__
293293 int is_true = PyObject_IsTrue (slots );
@@ -300,7 +300,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
300300 PyErr_Clear ();
301301 }
302302
303- if (PyObject_SetAttrString ((PyObject * )t , " __module__" , modname ) < 0 )
303+ if (PyObject_SetAttr ((PyObject * )t , mypyc_interned_str . __module__ , modname ) < 0 )
304304 goto error ;
305305
306306 if (init_subclass ((PyTypeObject * )t , NULL ))
@@ -460,7 +460,7 @@ CPyPickle_GetState(PyObject *obj)
460460{
461461 PyObject * attrs = NULL , * state = NULL ;
462462
463- attrs = PyObject_GetAttrString ((PyObject * )Py_TYPE (obj ), " __mypyc_attrs__" );
463+ attrs = PyObject_GetAttr ((PyObject * )Py_TYPE (obj ), mypyc_interned_str . __mypyc_attrs__ );
464464 if (!attrs ) {
465465 goto fail ;
466466 }
@@ -736,7 +736,7 @@ int CPyStatics_Initialize(PyObject **statics,
736736// Call super(type(self), self)
737737PyObject *
738738CPy_Super (PyObject * builtins , PyObject * self ) {
739- PyObject * super_type = PyObject_GetAttrString (builtins , " super" );
739+ PyObject * super_type = PyObject_GetAttr (builtins , mypyc_interned_str . super );
740740 if (!super_type )
741741 return NULL ;
742742 PyObject * result = PyObject_CallFunctionObjArgs (
@@ -891,7 +891,7 @@ CPy_CallReverseOpMethod(PyObject *left,
891891PyObject * CPySingledispatch_RegisterFunction (PyObject * singledispatch_func ,
892892 PyObject * cls ,
893893 PyObject * func ) {
894- PyObject * registry = PyObject_GetAttrString (singledispatch_func , " registry" );
894+ PyObject * registry = PyObject_GetAttr (singledispatch_func , mypyc_interned_str . registry );
895895 PyObject * register_func = NULL ;
896896 PyObject * typing = NULL ;
897897 PyObject * get_type_hints = NULL ;
@@ -904,7 +904,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,
904904 // passed a class
905905 // bind cls to the first argument so that register gets called again with both the
906906 // class and the function
907- register_func = PyObject_GetAttrString (singledispatch_func , "register" );
907+ register_func = PyObject_GetAttr (singledispatch_func , mypyc_interned_str . register_ );
908908 if (register_func == NULL ) goto fail ;
909909 return PyMethod_New (register_func , cls );
910910 }
@@ -925,7 +925,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,
925925 func = cls ;
926926 typing = PyImport_ImportModule ("typing" );
927927 if (typing == NULL ) goto fail ;
928- get_type_hints = PyObject_GetAttrString (typing , " get_type_hints" );
928+ get_type_hints = PyObject_GetAttr (typing , mypyc_interned_str . get_type_hints );
929929
930930 type_hints = PyObject_CallOneArg (get_type_hints , func );
931931 PyObject * argname ;
@@ -946,7 +946,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,
946946 }
947947
948948 // clear the cache so we consider the newly added function when dispatching
949- PyObject * dispatch_cache = PyObject_GetAttrString (singledispatch_func , " dispatch_cache" );
949+ PyObject * dispatch_cache = PyObject_GetAttr (singledispatch_func , mypyc_interned_str . dispatch_cache );
950950 if (dispatch_cache == NULL ) goto fail ;
951951 PyDict_Clear (dispatch_cache );
952952
0 commit comments