summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index e44dc8c..2a4b5cc 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -182,6 +182,13 @@ PyImport_ExecCodeModule(name, co)
if (v == NULL)
return NULL;
Py_DECREF(v);
+
+ if ((m = PyDict_GetItemString(_PyImport_Modules, name)) == NULL) {
+ PyErr_SetString(PyExc_SystemError,
+ "loaded module not found in sys.modules");
+ return NULL;
+ }
+
Py_INCREF(m);
return m;