mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Issue #15767: Use ModuleNotFoundError.
This commit is contained in:
parent
c943265ba5
commit
46f97b85a8
16 changed files with 337 additions and 284 deletions
|
@ -1539,7 +1539,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue