diff Python/_warnings.c @ 86974:954167ce92a3

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.
author Victor Stinner <victor.stinner@gmail.com>
date Wed, 06 Nov 2013 22:41:44 +0100
parents 13a05ed33cf7
children 01c4a0af73cf
line wrap: on
line diff
--- a/Python/_warnings.c	Wed Nov 06 22:40:41 2013 +0100
+++ b/Python/_warnings.c	Wed Nov 06 22:41:44 2013 +0100
@@ -265,7 +265,7 @@
     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 @@
     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) {