diff options
author | Georg Brandl <georg@python.org> | 2005-09-14 06:56:20 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-09-14 06:56:20 (GMT) |
commit | 0c55f2946b559bd5f6dec457accdc2f2c9c55d3a (patch) | |
tree | 6fa1e04ef3dee87bb0ea3061d7577f2df4aa2f36 /Python | |
parent | 14f4fd0a9e8835b9e75976760d13e8dab495bd9c (diff) | |
download | cpython-0c55f2946b559bd5f6dec457accdc2f2c9c55d3a.zip cpython-0c55f2946b559bd5f6dec457accdc2f2c9c55d3a.tar.gz cpython-0c55f2946b559bd5f6dec457accdc2f2c9c55d3a.tar.bz2 |
Patch #1290454: Fix reload() error message when parent module is not in
sys.modules.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c index c03d4cc..7cd5813 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2288,13 +2288,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) |