diff options
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index d463683..6d2cc96 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -162,18 +162,16 @@ static PyObject * sys_displayhook(PyObject *self, PyObject *o) { PyObject *outf; - PyObject *modules = PyImport_GetModuleDict(); - if (modules == NULL) - return NULL; PyObject *builtins; static PyObject *newline = NULL; int err; - builtins = _PyDict_GetItemId(modules, &PyId_builtins); + builtins = _PyImport_GetModuleId(&PyId_builtins); if (builtins == NULL) { PyErr_SetString(PyExc_RuntimeError, "lost builtins module"); return NULL; } + Py_DECREF(builtins); /* Print value except if None */ /* After printing, also assign to '_' */ |