Kaydet (Commit) 6b64a680 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #18408: Fix compiler_import() to handle PyUnicode_Substring() failure properly

üst 9a4fb669
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment