mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867)
This commit is contained in:
parent
775ccdf1fc
commit
7d110042c5
3 changed files with 11 additions and 1 deletions
|
@ -1389,7 +1389,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
|
|||
if (builtins_import == NULL) {
|
||||
builtins_import = _PyDict_GetItemId(interp->builtins, &PyId___import__);
|
||||
if (builtins_import == NULL) {
|
||||
Py_FatalError("__import__ missing");
|
||||
PyErr_SetString(PyExc_ImportError, "__import__ not found");
|
||||
goto error_with_unlock;
|
||||
}
|
||||
}
|
||||
Py_INCREF(builtins_import);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue