Use identifier API for PyObject_GetAttrString.
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e563107..ebc9cb8 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -247,10 +247,11 @@
     PyObject *f_stderr;
     PyObject *name;
     char lineno_str[128];
+    _Py_identifier(__name__);
 
     PyOS_snprintf(lineno_str, sizeof(lineno_str), ":%d: ", lineno);
 
-    name = PyObject_GetAttrString(category, "__name__");
+    name = _PyObject_GetAttrId(category, &PyId___name__);
     if (name == NULL)  /* XXX Can an object lack a '__name__' attribute? */
         return;