summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-11 20:50:45 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-11 20:50:45 (GMT)
commit6b64a6803e17805a6a4fb9a82f7ec26bdc30a6d5 (patch)
treeb63f27334f02dcd319e9220c05039f8935e9dbc3 /Python
parent9a4fb669668843de94c82c9e6de86a2ffa865eb7 (diff)
downloadcpython-6b64a6803e17805a6a4fb9a82f7ec26bdc30a6d5.zip
cpython-6b64a6803e17805a6a4fb9a82f7ec26bdc30a6d5.tar.gz
cpython-6b64a6803e17805a6a4fb9a82f7ec26bdc30a6d5.tar.bz2
Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4fc7575..d11e3ab 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);