summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-04-29 13:08:14 (GMT)
committerBenjamin Peterson <benjamin@python.org>2013-04-29 13:08:14 (GMT)
commit7d110042c5a2b27ffd0b3ae25dc7722f2f8bc5c5 (patch)
tree564d77b977a6af962a1be77073327466c42ecd59 /Python/import.c
parent775ccdf1fc87922f8fe0d46a3e8cd5f0a6a54218 (diff)
downloadcpython-7d110042c5a2b27ffd0b3ae25dc7722f2f8bc5c5.zip
cpython-7d110042c5a2b27ffd0b3ae25dc7722f2f8bc5c5.tar.gz
cpython-7d110042c5a2b27ffd0b3ae25dc7722f2f8bc5c5.tar.bz2
raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867)
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 5fc2523..26261e1 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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);