Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 35542:81259009ba2c legacy-trunk
Patch #1290454: Fix reload() error message when parent module is not in
sys.modules.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Wed, 14 Sep 2005 06:56:20 +0000 |
| parents | 44e3f21f0525 |
| children | 724bbd489ad4 |
line wrap: on
line diff
--- a/Python/import.c Tue Sep 13 19:56:06 2005 +0000 +++ b/Python/import.c Wed Sep 14 06:56:20 2005 +0000 @@ -2288,13 +2288,14 @@ 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)
