diff Python/import.c @ 83549:08ce30768003 3.3

raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867)
author Benjamin Peterson <benjamin@python.org>
date Mon, 29 Apr 2013 09:08:14 -0400
parents 1ee9cf5a5351
children 80a5c2c2fb8a 393723b646a4
line wrap: on
line diff
--- a/Python/import.c	Sun Apr 28 17:06:01 2013 -0400
+++ b/Python/import.c	Mon Apr 29 09:08:14 2013 -0400
@@ -1389,7 +1389,8 @@
     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);