diff Python/compile.c @ 84563:aaa6e8b8a5c9

Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly
author Victor Stinner <victor.stinner@gmail.com>
date Thu, 11 Jul 2013 22:50:45 +0200
parents d1ba1228a04f
children df2fdd42b375
line wrap: on
line diff
--- a/Python/compile.c	Thu Jul 11 22:49:00 2013 +0200
+++ b/Python/compile.c	Thu Jul 11 22:50:45 2013 +0200
@@ -2316,8 +2316,11 @@
             identifier tmp = alias->name;
             Py_ssize_t dot = PyUnicode_FindChar(
                 alias->name, '.', 0, PyUnicode_GET_LENGTH(alias->name), 1);
-            if (dot != -1)
+            if (dot != -1) {
                 tmp = PyUnicode_Substring(alias->name, 0, dot);
+                if (tmp == NULL)
+                    return 0;
+            }
             r = compiler_nameop(c, tmp, Store);
             if (dot != -1) {
                 Py_DECREF(tmp);