summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 0bb46d2..fad54e6 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1436,7 +1436,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
PyObject *msg = PyUnicode_FromFormat("import of %R halted; "
"None in sys.modules", abs_name);
if (msg != NULL) {
- PyErr_SetImportError(msg, abs_name, NULL);
+ PyErr_SetImportErrorSubclass(PyExc_ModuleNotFoundError, msg,
+ abs_name, NULL);
Py_DECREF(msg);
}
mod = NULL;