Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.

Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
diff --git a/Objects/object.c b/Objects/object.c
index 9d96e86..acc34af 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -8,6 +8,12 @@
 extern "C" {
 #endif
 
+_Py_IDENTIFIER(Py_Repr);
+_Py_IDENTIFIER(__bytes__);
+_Py_IDENTIFIER(__dir__);
+_Py_IDENTIFIER(__isabstractmethod__);
+_Py_IDENTIFIER(builtins);
+
 #ifdef Py_REF_DEBUG
 Py_ssize_t _Py_RefTotal;
 
@@ -560,7 +566,6 @@
 PyObject_Bytes(PyObject *v)
 {
     PyObject *result, *func;
-    _Py_IDENTIFIER(__bytes__);
 
     if (v == NULL)
         return PyBytes_FromString("<NULL>");
@@ -949,7 +954,6 @@
 {
     int res;
     PyObject* isabstract;
-    _Py_IDENTIFIER(__isabstractmethod__);
 
     if (obj == NULL)
         return 0;
@@ -1124,7 +1128,7 @@
 {
     PyObject *mod_name, *mod, *attr;
 
-    mod_name = _PyUnicode_FromId(&_PyId_builtins);   /* borrowed */
+    mod_name = _PyUnicode_FromId(&PyId_builtins);   /* borrowed */
     if (mod_name == NULL)
         return NULL;
     mod = PyImport_Import(mod_name);
@@ -1440,7 +1444,6 @@
 _dir_object(PyObject *obj)
 {
     PyObject *result, *sorted;
-    _Py_IDENTIFIER(__dir__);
     PyObject *dirfunc = _PyObject_LookupSpecial(obj, &PyId___dir__);
 
     assert(obj);
@@ -1973,8 +1976,6 @@
    See dictobject.c and listobject.c for examples of use.
 */
 
-_Py_IDENTIFIER(Py_Repr);
-
 int
 Py_ReprEnter(PyObject *obj)
 {
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 8bccb68..0708d67 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -53,6 +53,7 @@
 _Py_IDENTIFIER(__name__);
 _Py_IDENTIFIER(__new__);
 _Py_IDENTIFIER(__setitem__);
+_Py_IDENTIFIER(builtins);
 
 static PyObject *
 slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
@@ -366,7 +367,7 @@
         if (s != NULL)
             return PyUnicode_FromStringAndSize(
                 type->tp_name, (Py_ssize_t)(s - type->tp_name));
-        name = _PyUnicode_FromId(&_PyId_builtins);
+        name = _PyUnicode_FromId(&PyId_builtins);
         Py_XINCREF(name);
         return name;
     }
@@ -718,7 +719,7 @@
         return NULL;
     }
 
-    if (mod != NULL && _PyUnicode_CompareWithId(mod, &_PyId_builtins))
+    if (mod != NULL && _PyUnicode_CompareWithId(mod, &PyId_builtins))
         rtn = PyUnicode_FromFormat("<class '%U.%U'>", mod, name);
     else
         rtn = PyUnicode_FromFormat("<class '%s'>", type->tp_name);
@@ -3189,7 +3190,7 @@
         Py_XDECREF(mod);
         return NULL;
     }
-    if (mod != NULL && _PyUnicode_CompareWithId(mod, &_PyId_builtins))
+    if (mod != NULL && _PyUnicode_CompareWithId(mod, &PyId_builtins))
         rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self);
     else
         rtn = PyUnicode_FromFormat("<%s object at %p>",