diff Python/import.c @ 87079:8e40d07d3cd2

Issue #19437: Fix PyImport_ImportModuleLevelObject(), handle PyUnicode_Substring() failure (ex: MemoryError)
author Victor Stinner <victor.stinner@gmail.com>
date Wed, 13 Nov 2013 12:11:36 +0100
parents 01c4a0af73cf
children f7d401eaee0e
line wrap: on
line diff
--- a/Python/import.c	Wed Nov 13 22:24:58 2013 +1000
+++ b/Python/import.c	Wed Nov 13 12:11:36 2013 +0100
@@ -1364,7 +1364,11 @@
                 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;