summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-06 21:41:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-06 21:41:44 (GMT)
commit090543736fa86c676252de7a44e6a7c6f347164e (patch)
treeca82d3bf4857aa474ba91d81c64cc946a22d31a0 /Modules
parentbb52020d44b6f3f1ebd16ec6ce38f1f8a6330728 (diff)
downloadcpython-090543736fa86c676252de7a44e6a7c6f347164e.zip
cpython-090543736fa86c676252de7a44e6a7c6f347164e.tar.gz
cpython-090543736fa86c676252de7a44e6a7c6f347164e.tar.bz2
Issue #19512: add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/callbacks.c2
-rw-r--r--Modules/_cursesmodule.c2
-rw-r--r--Modules/_threadmodule.c2
-rw-r--r--Modules/faulthandler.c2
-rw-r--r--Modules/main.c2
-rw-r--r--Modules/syslogmodule.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index ec8fd12..756f4ef 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_GetObject("stderr");
+ PyObject *f = _PySys_GetObjectId(&_PyId_stderr);
va_list marker;
va_start(marker, msg);
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 1f192dc..5cdd926 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_GetObject("stdout");
+ sys_stdout = _PySys_GetObjectId(&_PyId_stdout);
if (sys_stdout == NULL || sys_stdout == Py_None) {
PyErr_SetString(
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 32656c9..a7123b7 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1005,7 +1005,7 @@ t_bootstrap(void *boot_raw)
PySys_WriteStderr(
"Unhandled exception in thread started by ");
PyErr_Fetch(&exc, &value, &tb);
- file = PySys_GetObject("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 47bc9e8..315b32d 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -136,7 +136,7 @@ faulthandler_get_fileno(PyObject *file, int *p_fd)
int fd;
if (file == NULL || file == Py_None) {
- file = PySys_GetObject("stderr");
+ file = _PySys_GetObjectId(&_PyId_stderr);
if (file == NULL) {
PyErr_SetString(PyExc_RuntimeError, "unable to get sys.stderr");
return NULL;
diff --git a/Modules/main.c b/Modules/main.c
index 9171070..4b1a968 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_GetObject("path");
+ sys_path = _PySys_GetObjectId(&_PyId_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 9d79eec..edd12ab 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_GetObject("argv");
+ PyObject *argv = _PySys_GetObjectId(&_PyId_argv);
if (argv == NULL) {
return(NULL);