summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
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 /Python/_warnings.c
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 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e88f646..de60128 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -265,7 +265,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_GetObject("stderr");
+ f_stderr = _PySys_GetObjectId(&_PyId_stderr);
if (f_stderr == NULL) {
fprintf(stderr, "lost sys.stderr\n");
goto error;
@@ -562,7 +562,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_GetObject("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) {