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.
This commit is contained in:
Victor Stinner 2013-11-07 23:07:29 +01:00
parent 07e9e380f9
commit bd303c165b
17 changed files with 93 additions and 89 deletions

View file

@ -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 *
PyObject_Bytes(PyObject *v)
{
PyObject *result, *func;
_Py_IDENTIFIER(__bytes__);
if (v == NULL)
return PyBytes_FromString("<NULL>");
@ -949,7 +954,6 @@ _PyObject_IsAbstract(PyObject *obj)
{
int res;
PyObject* isabstract;
_Py_IDENTIFIER(__isabstractmethod__);
if (obj == NULL)
return 0;
@ -1124,7 +1128,7 @@ _PyObject_GetBuiltin(const char *name)
{
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 @@ static PyObject *
_dir_object(PyObject *obj)
{
PyObject *result, *sorted;
_Py_IDENTIFIER(__dir__);
PyObject *dirfunc = _PyObject_LookupSpecial(obj, &PyId___dir__);
assert(obj);
@ -1973,8 +1976,6 @@ _PyObject_DebugTypeStats(FILE *out)
See dictobject.c and listobject.c for examples of use.
*/
_Py_IDENTIFIER(Py_Repr);
int
Py_ReprEnter(PyObject *obj)
{