mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Backport of patch #1290454: Fix reload() error message when parent is not
in sys.modules.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user