From bb52020d44b6f3f1ebd16ec6ce38f1f8a6330728 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 6 Nov 2013 22:40:41 +0100 Subject: Issue #19512: pickle now uses an identifier to only create the Unicode string "modules" once --- Modules/_pickle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/_pickle.c b/Modules/_pickle.c index a14a258..75b0441 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -136,6 +136,8 @@ static PyObject *empty_tuple = NULL; /* 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 @@ whichmodule(PyObject *global, PyObject *global_name) 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 @@ Unpickler_find_class(UnpicklerObject *self, PyObject *args) } } - 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; -- cgit v0.12