[Python-checkins] cpython: Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure

victor.stinner python-checkins at python.org
Thu Jul 11 23:12:10 CEST 2013


http://hg.python.org/cpython/rev/aaa6e8b8a5c9
changeset:   84563:aaa6e8b8a5c9
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Jul 11 22:50:45 2013 +0200
summary:
  Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly

files:
  Python/compile.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Python/compile.c b/Python/compile.c
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list