summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-09-14 06:56:51 (GMT)
committerGeorg Brandl <georg@python.org>2005-09-14 06:56:51 (GMT)
commit32cb7f080dea6b99db52dd15fbc8a1e1eba88748 (patch)
treec31d76fe5f6919fb8ecd4e6170339c5a7f27051a /Python
parentae4ae43a40607ef4c64497e2a62762d9156a88d5 (diff)
downloadcpython-32cb7f080dea6b99db52dd15fbc8a1e1eba88748.zip
cpython-32cb7f080dea6b99db52dd15fbc8a1e1eba88748.tar.gz
cpython-32cb7f080dea6b99db52dd15fbc8a1e1eba88748.tar.bz2
Backport of patch #1290454: Fix reload() error message when parent is not
in sys.modules.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index 75c6d3e..72a5605 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2298,13 +2298,14 @@ PyImport_ReloadModule(PyObject *m)
if (parentname == NULL)
return NULL;
parent = PyDict_GetItem(modules, parentname);
- Py_DECREF(parentname);
if (parent == NULL) {
PyErr_Format(PyExc_ImportError,
"reload(): parent %.200s not in sys.modules",
- name);
+ PyString_AS_STRING(parentname));
+ Py_DECREF(parentname);
return NULL;
}
+ Py_DECREF(parentname);
subname++;
path = PyObject_GetAttrString(parent, "__path__");
if (path == NULL)