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

@ -13,6 +13,8 @@ static PyObject *_filters; /* List */
static PyObject *_once_registry; /* Dict */
static PyObject *_default_action; /* String */
_Py_IDENTIFIER(argv);
_Py_IDENTIFIER(stderr);
static int
check_matched(PyObject *obj, PyObject *arg)
@ -265,7 +267,7 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
if (name == NULL) /* XXX Can an object lack a '__name__' attribute? */
goto error;
f_stderr = _PySys_GetObjectId(&_PyId_stderr);
f_stderr = _PySys_GetObjectId(&PyId_stderr);
if (f_stderr == NULL) {
fprintf(stderr, "lost sys.stderr\n");
goto error;
@ -562,7 +564,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
else {
*filename = NULL;
if (*module != Py_None && PyUnicode_CompareWithASCIIString(*module, "__main__") == 0) {
PyObject *argv = _PySys_GetObjectId(&_PyId_argv);
PyObject *argv = _PySys_GetObjectId(&PyId_argv);
/* PyList_Check() is needed because sys.argv is set to None during
Python finalization */
if (argv != NULL && PyList_Check(argv) && PyList_Size(argv) > 0) {