summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index f3de7d8262..3e620b3706 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2355,8 +2355,9 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
}
}
else {
- package = _PyDict_GetItemIdWithError(globals, &PyId___name__);
+ package = _PyDict_GetItemId(globals, &PyId___name__);
if (package == NULL) {
+ PyErr_SetString(PyExc_KeyError, "'__name__' not in globals");
goto error;
}
else if (!PyUnicode_Check(package)) {