From: Victor Stinner Date: Thu, 11 Jul 2013 20:50:45 +0000 (+0200) Subject: Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly X-Git-Tag: v3.4.0a1~252 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b64a6803e17805a6a4fb9a82f7ec26bdc30a6d5;p=python Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly --- diff --git a/Python/compile.c b/Python/compile.c index 4fc7575926..d11e3abeaa 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2316,8 +2316,11 @@ compiler_import(struct compiler *c, stmt_ty s) 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);