From 22af2599a9f5724664aefb7146427cb4de4d65d3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 13 Nov 2013 12:11:36 +0100 Subject: Issue #19437: Fix PyImport_ImportModuleLevelObject(), handle PyUnicode_Substring() failure (ex: MemoryError) --- Python/import.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/import.c b/Python/import.c index c96106f..ad181a2 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; -- cgit v0.12