diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-07 22:07:29 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-07 22:07:29 (GMT) |
commit | bd303c165bc914fc943026ece55f4ebd225614c9 (patch) | |
tree | 030e6e557eff5ec98fef23e359498824f21afe4a /Modules | |
parent | 07e9e380f93e334f8f11d3ff9f42bf7c68b27d3a (diff) | |
download | cpython-bd303c165bc914fc943026ece55f4ebd225614c9.zip cpython-bd303c165bc914fc943026ece55f4ebd225614c9.tar.gz cpython-bd303c165bc914fc943026ece55f4ebd225614c9.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/callbacks.c | 2 | ||||
-rw-r--r-- | Modules/_cursesmodule.c | 2 | ||||
-rw-r--r-- | Modules/_lsprof.c | 2 | ||||
-rw-r--r-- | Modules/_threadmodule.c | 4 | ||||
-rw-r--r-- | Modules/faulthandler.c | 10 | ||||
-rw-r--r-- | Modules/main.c | 2 | ||||
-rw-r--r-- | Modules/syslogmodule.c | 2 |
7 files changed, 14 insertions, 10 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 756f4ef..ec8fd12 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -80,7 +80,7 @@ static void PrintError(char *msg, ...) { char buf[512]; - PyObject *f = _PySys_GetObjectId(&_PyId_stderr); + PyObject *f = PySys_GetObject("stderr"); va_list marker; va_start(marker, msg); diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 5cdd926..1f192dc 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -2578,7 +2578,7 @@ PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds) if (fd == -1) { PyObject* sys_stdout; - sys_stdout = _PySys_GetObjectId(&_PyId_stdout); + sys_stdout = PySys_GetObject("stdout"); if (sys_stdout == NULL || sys_stdout == Py_None) { PyErr_SetString( diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 3ef7d65..8947889 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -185,7 +185,7 @@ normalizeUserObj(PyObject *obj) } } if (modname != NULL) { - if (_PyUnicode_CompareWithId(modname, &_PyId_builtins) != 0) { + if (PyUnicode_CompareWithASCIIString(modname, "builtins") != 0) { PyObject *result; result = PyUnicode_FromFormat("<%U.%s>", modname, fn->m_ml->ml_name); diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index a7123b7..ab0fea4 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -17,6 +17,8 @@ static PyObject *ThreadError; static long nb_threads = 0; static PyObject *str_dict; +_Py_IDENTIFIER(stderr); + /* Lock objects */ typedef struct { @@ -1005,7 +1007,7 @@ t_bootstrap(void *boot_raw) PySys_WriteStderr( "Unhandled exception in thread started by "); PyErr_Fetch(&exc, &value, &tb); - file = _PySys_GetObjectId(&_PyId_stderr); + file = _PySys_GetObjectId(&PyId_stderr); if (file != NULL && file != Py_None) PyFile_WriteObject(boot->func, file, 0); else diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 315b32d..27b1d54 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -26,6 +26,11 @@ (anyway, the length is smaller than 30 characters) */ #define PUTS(fd, str) write(fd, str, (int)strlen(str)) +_Py_IDENTIFIER(enable); +_Py_IDENTIFIER(fileno); +_Py_IDENTIFIER(flush); +_Py_IDENTIFIER(stderr); + #ifdef HAVE_SIGACTION typedef struct sigaction _Py_sighandler_t; #else @@ -130,13 +135,11 @@ static PyObject* faulthandler_get_fileno(PyObject *file, int *p_fd) { PyObject *result; - _Py_IDENTIFIER(fileno); - _Py_IDENTIFIER(flush); long fd_long; int fd; if (file == NULL || file == Py_None) { - file = _PySys_GetObjectId(&_PyId_stderr); + file = _PySys_GetObjectId(&PyId_stderr); if (file == NULL) { PyErr_SetString(PyExc_RuntimeError, "unable to get sys.stderr"); return NULL; @@ -1047,7 +1050,6 @@ static int faulthandler_env_options(void) { PyObject *xoptions, *key, *module, *res; - _Py_IDENTIFIER(enable); char *p; if (!((p = Py_GETENV("PYTHONFAULTHANDLER")) && *p != '\0')) { diff --git a/Modules/main.c b/Modules/main.c index 4b1a968..9171070 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -261,7 +261,7 @@ RunMainFromImporter(wchar_t *filename) /* argv0 is usable as an import source, so put it in sys.path[0] and import __main__ */ - sys_path = _PySys_GetObjectId(&_PyId_path); + sys_path = PySys_GetObject("path"); if (sys_path == NULL) { PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path"); goto error; diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index edd12ab..9d79eec 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -71,7 +71,7 @@ syslog_get_argv(void) Py_ssize_t argv_len, scriptlen; PyObject *scriptobj; Py_ssize_t slash; - PyObject *argv = _PySys_GetObjectId(&_PyId_argv); + PyObject *argv = PySys_GetObject("argv"); if (argv == NULL) { return(NULL); |