diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-13 11:11:36 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-13 11:11:36 (GMT) |
commit | 22af2599a9f5724664aefb7146427cb4de4d65d3 (patch) | |
tree | c82cc8d0ecc42350e32fcbb6bca662fa3080d55c /Python | |
parent | d3e83e2a3e88cc424d14d9aaff09d03feed1a10f (diff) | |
download | cpython-22af2599a9f5724664aefb7146427cb4de4d65d3.zip cpython-22af2599a9f5724664aefb7146427cb4de4d65d3.tar.gz cpython-22af2599a9f5724664aefb7146427cb4de4d65d3.tar.bz2 |
Issue #19437: Fix PyImport_ImportModuleLevelObject(), handle
PyUnicode_Substring() failure (ex: MemoryError)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |