summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index c96106f373..ad181a2942 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1364,7 +1364,11 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
goto error;
}
}
+
base = PyUnicode_Substring(package, 0, last_dot);
+ if (base == NULL)
+ goto error;
+
if (PyUnicode_GET_LENGTH(name) > 0) {
PyObject *borrowed_dot, *seq = NULL;