Use identifier API for PyObject_GetAttrString.
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 40e253d..0c68aa8 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -767,8 +767,9 @@
 deque_reduce(dequeobject *deque)
 {
     PyObject *dict, *result, *aslist;
+    _Py_identifier(__dict__);
 
-    dict = PyObject_GetAttrString((PyObject *)deque, "__dict__");
+    dict = _PyObject_GetAttrId((PyObject *)deque, &PyId___dict__);
     if (dict == NULL)
         PyErr_Clear();
     aslist = PySequence_List((PyObject *)deque);
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 1334633..59c74e7 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -1317,6 +1317,7 @@
 {
     PyObject * output_file, * dialect = NULL;
     WriterObj * self = PyObject_GC_New(WriterObj, &Writer_Type);
+    _Py_identifier(write);
 
     if (!self)
         return NULL;
@@ -1333,7 +1334,7 @@
         Py_DECREF(self);
         return NULL;
     }
-    self->writeline = PyObject_GetAttrString(output_file, "write");
+    self->writeline = _PyObject_GetAttrId(output_file, &PyId_write);
     if (self->writeline == NULL || !PyCallable_Check(self->writeline)) {
         PyErr_SetString(PyExc_TypeError,
                         "argument 1 must have a \"write\" method");
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index eb6998f..4dceaa9 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -3077,12 +3077,14 @@
 {
     PyObject *args, *state, *tmp;
     PyObject *getinitargs, *getstate;
+    _Py_identifier(__getinitargs__);
+    _Py_identifier(__getstate__);
 
     tmp = PyTuple_New(0);
     if (tmp == NULL)
         return NULL;
 
-    getinitargs = PyObject_GetAttrString(self, "__getinitargs__");
+    getinitargs = _PyObject_GetAttrId(self, &PyId___getinitargs__);
     if (getinitargs != NULL) {
         args = PyObject_CallObject(getinitargs, tmp);
         Py_DECREF(getinitargs);
@@ -3097,7 +3099,7 @@
         Py_INCREF(args);
     }
 
-    getstate = PyObject_GetAttrString(self, "__getstate__");
+    getstate = _PyObject_GetAttrId(self, &PyId___getstate__);
     if (getstate != NULL) {
         state = PyObject_CallObject(getstate, tmp);
         Py_DECREF(getstate);
diff --git a/Modules/_json.c b/Modules/_json.c
index e49d1b2..f777de5 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1126,6 +1126,7 @@
     PyObject *ctx;
     static char *kwlist[] = {"context", NULL};
     PyScannerObject *s;
+    _Py_identifier(strict);
 
     assert(PyScanner_Check(self));
     s = (PyScannerObject *)self;
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index e53abc8..6a44b82 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -826,8 +826,9 @@
 static int
 _Pickler_SetOutputStream(PicklerObject *self, PyObject *file)
 {
+    _Py_identifier(write);
     assert(file != NULL);
-    self->write = PyObject_GetAttrString(file, "write");
+    self->write = _PyObject_GetAttrId(file, &PyId_write);
     if (self->write == NULL) {
         if (PyErr_ExceptionMatches(PyExc_AttributeError))
             PyErr_SetString(PyExc_TypeError,
@@ -1173,15 +1174,19 @@
 static int
 _Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file)
 {
-    self->peek = PyObject_GetAttrString(file, "peek");
+    _Py_identifier(peek);
+    _Py_identifier(read);
+    _Py_identifier(readline);
+
+    self->peek = _PyObject_GetAttrId(file, &PyId_peek);
     if (self->peek == NULL) {
         if (PyErr_ExceptionMatches(PyExc_AttributeError))
             PyErr_Clear();
         else
             return -1;
     }
-    self->read = PyObject_GetAttrString(file, "read");
-    self->readline = PyObject_GetAttrString(file, "readline");
+    self->read = _PyObject_GetAttrId(file, &PyId_read);
+    self->readline = _PyObject_GetAttrId(file, &PyId_readline);
     if (self->readline == NULL || self->read == NULL) {
         if (PyErr_ExceptionMatches(PyExc_AttributeError))
             PyErr_SetString(PyExc_TypeError,
@@ -3390,6 +3395,7 @@
     PyObject *file;
     PyObject *proto_obj = NULL;
     PyObject *fix_imports = Py_True;
+    _Py_identifier(persistent_id);
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO:Pickler",
                                      kwlist, &file, &proto_obj, &fix_imports))
@@ -3425,9 +3431,9 @@
     self->fast_nesting = 0;
     self->fast_memo = NULL;
     self->pers_func = NULL;
-    if (PyObject_HasAttrString((PyObject *)self, "persistent_id")) {
-        self->pers_func = PyObject_GetAttrString((PyObject *)self,
-                                                 "persistent_id");
+    if (_PyObject_HasAttrId((PyObject *)self, &PyId_persistent_id)) {
+        self->pers_func = _PyObject_GetAttrId((PyObject *)self,
+                                              &PyId_persistent_id);
         if (self->pers_func == NULL)
             return -1;
     }
@@ -4935,8 +4941,9 @@
     }
     else {
         PyObject *append_func;
+        _Py_identifier(append);
 
-        append_func = PyObject_GetAttrString(list, "append");
+        append_func = _PyObject_GetAttrId(list, &PyId_append);
         if (append_func == NULL)
             return -1;
         for (i = x; i < len; i++) {
@@ -5023,6 +5030,7 @@
     PyObject *state, *inst, *slotstate;
     PyObject *setstate;
     int status = 0;
+    _Py_identifier(__setstate__);
 
     /* Stack is ... instance, state.  We want to leave instance at
      * the stack top, possibly mutated via instance.__setstate__(state).
@@ -5036,7 +5044,7 @@
 
     inst = self->stack->data[Py_SIZE(self->stack) - 1];
 
-    setstate = PyObject_GetAttrString(inst, "__setstate__");
+    setstate = _PyObject_GetAttrId(inst, &PyId___setstate__);
     if (setstate == NULL) {
         if (PyErr_ExceptionMatches(PyExc_AttributeError))
             PyErr_Clear();
@@ -5079,12 +5087,13 @@
         PyObject *dict;
         PyObject *d_key, *d_value;
         Py_ssize_t i;
+        _Py_identifier(__dict__);
 
         if (!PyDict_Check(state)) {
             PyErr_SetString(UnpicklingError, "state is not a dictionary");
             goto error;
         }
-        dict = PyObject_GetAttrString(inst, "__dict__");
+        dict = _PyObject_GetAttrId(inst, &PyId___dict__);
         if (dict == NULL)
             goto error;
 
@@ -5584,8 +5593,9 @@
         return -1;
 
     if (PyObject_HasAttrString((PyObject *)self, "persistent_load")) {
-        self->pers_func = PyObject_GetAttrString((PyObject *)self,
-                                                 "persistent_load");
+        _Py_identifier(persistent_load);
+        self->pers_func = _PyObject_GetAttrId((PyObject *)self,
+                                              &PyId_persistent_load);
         if (self->pers_func == NULL)
             return -1;
     }
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 6cedee4..cb86de7 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2003,14 +2003,16 @@
     int mformat_code;
     static PyObject *array_reconstructor = NULL;
     long protocol;
+    _Py_identifier(_array_reconstructor);
+    _Py_identifier(__dict__);
 
     if (array_reconstructor == NULL) {
         PyObject *array_module = PyImport_ImportModule("array");
         if (array_module == NULL)
             return NULL;
-        array_reconstructor = PyObject_GetAttrString(
+        array_reconstructor = _PyObject_GetAttrId(
             array_module,
-            "_array_reconstructor");
+            &PyId__array_reconstructor);
         Py_DECREF(array_module);
         if (array_reconstructor == NULL)
             return NULL;
@@ -2025,7 +2027,7 @@
     if (protocol == -1 && PyErr_Occurred())
         return NULL;
 
-    dict = PyObject_GetAttrString((PyObject *)array, "__dict__");
+    dict = _PyObject_GetAttrId((PyObject *)array, &PyId___dict__);
     if (dict == NULL) {
         if (!PyErr_ExceptionMatches(PyExc_AttributeError))
             return NULL;
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index f1679d7..3f03cee 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -3241,10 +3241,13 @@
     copyreg = PyImport_ImportModuleNoBlock("copyreg");
     if (copyreg != NULL) {
         PyObject *func, *pickler;
+        _Py_identifier(pickle);
+        _Py_identifier(sequence2st);
+        _Py_identifier(_pickler);
 
-        func = PyObject_GetAttrString(copyreg, "pickle");
-        pickle_constructor = PyObject_GetAttrString(module, "sequence2st");
-        pickler = PyObject_GetAttrString(module, "_pickler");
+        func = _PyObject_GetAttrId(copyreg, &PyId_pickle);
+        pickle_constructor = _PyObject_GetAttrId(module, &PyId_sequence2st);
+        pickler = _PyObject_GetAttrId(module, &PyId__pickler);
         Py_XINCREF(pickle_constructor);
         if ((func != NULL) && (pickle_constructor != NULL)
             && (pickler != NULL)) {
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index b19f1b3..30760ed 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6103,6 +6103,7 @@
 {
     PyObject *result;
     static PyObject *struct_rusage;
+    _Py_identifier(struct_rusage);
 
     if (pid == -1)
         return posix_error();
@@ -6111,7 +6112,7 @@
         PyObject *m = PyImport_ImportModuleNoBlock("resource");
         if (m == NULL)
             return NULL;
-        struct_rusage = PyObject_GetAttrString(m, "struct_rusage");
+        struct_rusage = _PyObject_GetAttrId(m, &PyId_struct_rusage);
         Py_DECREF(m);
         if (struct_rusage == NULL)
             return NULL;
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 6a8fe6d..45ab70e 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -843,9 +843,9 @@
 {
     int rv = 1;
     PyObject *readmethod = NULL;
+    _Py_identifier(read);
 
-
-    readmethod = PyObject_GetAttrString(f, "read");
+    readmethod = _PyObject_GetAttrId(f, &PyId_read);
     if (readmethod == NULL) {
         PyErr_SetString(PyExc_TypeError,
                         "argument must have 'read' attribute");
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 2293e66..3c07866 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -908,6 +908,7 @@
     static int importing_zlib = 0;
     PyObject *zlib;
     PyObject *decompress;
+    _Py_identifier(decompress);
 
     if (importing_zlib != 0)
         /* Someone has a zlib.py[co] in their Zip file;
@@ -917,8 +918,8 @@
     zlib = PyImport_ImportModuleNoBlock("zlib");
     importing_zlib = 0;
     if (zlib != NULL) {
-        decompress = PyObject_GetAttrString(zlib,
-                                            "decompress");
+        decompress = _PyObject_GetAttrId(zlib,
+                                         &PyId_decompress);
         Py_DECREF(zlib);
     }
     else {