[Python-checkins] cpython: Issue #19512: pickle now uses an identifier to only create the Unicode string

victor.stinner python-checkins at python.org
Wed Nov 6 22:46:29 CET 2013


http://hg.python.org/cpython/rev/6348764bacdd
changeset:   86973:6348764bacdd
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Nov 06 22:40:41 2013 +0100
summary:
  Issue #19512: pickle now uses an identifier to only create the Unicode string
"modules" once

files:
  Modules/_pickle.c |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -136,6 +136,8 @@
 /* For looking up name pairs in copyreg._extension_registry. */
 static PyObject *two_tuple = NULL;
 
+_Py_IDENTIFIER(modules);
+
 static int
 stack_underflow(void)
 {
@@ -1363,7 +1365,7 @@
         return NULL;
 
   search:
-    modules_dict = PySys_GetObject("modules");
+    modules_dict = _PySys_GetObjectId(&PyId_modules);
     if (modules_dict == NULL) {
         PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules");
         return NULL;
@@ -5548,7 +5550,7 @@
         }
     }
 
-    modules_dict = PySys_GetObject("modules");
+    modules_dict = _PySys_GetObjectId(&PyId_modules);
     if (modules_dict == NULL) {
         PyErr_SetString(PyExc_RuntimeError, "unable to get sys.modules");
         return NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list