Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index dddaa3a..8790243 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2454,6 +2454,8 @@
 {
     PyObject *o;
     PyObject *m = PyImport_ImportModuleNoBlock("curses");
+    _Py_IDENTIFIER(LINES);
+    _Py_IDENTIFIER(COLS);
 
     if (!m)
         return 0;
@@ -2463,12 +2465,13 @@
         Py_DECREF(m);
         return 0;
     }
-    if (PyObject_SetAttrString(m, "LINES", o)) {
+    if (_PyObject_SetAttrId(m, &PyId_LINES, o)) {
         Py_DECREF(m);
         Py_DECREF(o);
         return 0;
     }
-    if (PyDict_SetItemString(ModDict, "LINES", o)) {
+    /* PyId_LINES.object will be initialized here. */
+    if (PyDict_SetItem(ModDict, PyId_LINES.object, o)) {
         Py_DECREF(m);
         Py_DECREF(o);
         return 0;
@@ -2479,12 +2482,12 @@
         Py_DECREF(m);
         return 0;
     }
-    if (PyObject_SetAttrString(m, "COLS", o)) {
+    if (_PyObject_SetAttrId(m, &PyId_COLS, o)) {
         Py_DECREF(m);
         Py_DECREF(o);
         return 0;
     }
-    if (PyDict_SetItemString(ModDict, "COLS", o)) {
+    if (PyDict_SetItem(ModDict, PyId_COLS.object, o)) {
         Py_DECREF(m);
         Py_DECREF(o);
         return 0;
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 2c29b20..f1bb730 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -4388,12 +4388,13 @@
 instantiate(PyObject *cls, PyObject *args)
 {
     PyObject *result = NULL;
+    _Py_IDENTIFIER(__getinitargs__);
     /* Caller must assure args are a tuple.  Normally, args come from
        Pdata_poptuple which packs objects from the top of the stack
        into a newly created tuple. */
     assert(PyTuple_Check(args));
     if (Py_SIZE(args) > 0 || !PyType_Check(cls) ||
-        PyObject_HasAttrString(cls, "__getinitargs__")) {
+        _PyObject_HasAttrId(cls, &PyId___getinitargs__)) {
         result = PyObject_CallObject(cls, args);
     }
     else {
@@ -5557,6 +5558,7 @@
     PyObject *fix_imports = Py_True;
     char *encoding = NULL;
     char *errors = NULL;
+    _Py_IDENTIFIER(persistent_load);
 
     /* XXX: That is an horrible error message. But, I don't know how to do
        better... */
@@ -5591,8 +5593,7 @@
     if (self->fix_imports == -1)
         return -1;
 
-    if (PyObject_HasAttrString((PyObject *)self, "persistent_load")) {
-        _Py_IDENTIFIER(persistent_load);
+    if (_PyObject_HasAttrId((PyObject *)self, &PyId_persistent_load)) {
         self->pers_func = _PyObject_GetAttrId((PyObject *)self,
                                               &PyId_persistent_load);
         if (self->pers_func == NULL)
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 63f199b..15b0c17 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -626,6 +626,7 @@
 {
     Py_ssize_t i, n=2;
     PyObject *it, *iterable, *copyable, *result;
+    _Py_IDENTIFIER(__copy__);
 
     if (!PyArg_ParseTuple(args, "O|n", &iterable, &n))
         return NULL;
@@ -643,7 +644,7 @@
         Py_DECREF(result);
         return NULL;
     }
-    if (!PyObject_HasAttrString(it, "__copy__")) {
+    if (!_PyObject_HasAttrId(it, &PyId___copy__)) {
         copyable = tee_fromiterable(it);
         Py_DECREF(it);
         if (copyable == NULL) {
@@ -654,7 +655,6 @@
         copyable = it;
     PyTuple_SET_ITEM(result, 0, copyable);
     for (i=1 ; i<n ; i++) {
-        _Py_IDENTIFIER(__copy__);
 
         copyable = _PyObject_CallMethodId(copyable, &PyId___copy__, NULL);
         if (copyable == NULL) {