diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-09-08 06:58:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-08 06:58:51 (GMT) |
commit | e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c (patch) | |
tree | e3cf5fd257df7ac82e2bd47811720daf22ce0666 /Python/ceval.c | |
parent | 70c2dd306f575e8bc9edb10ced5c7a6a555d1c87 (diff) | |
download | cpython-e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c.zip cpython-e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c.tar.gz cpython-e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c.tar.bz2 |
bpo-31393: Fix the use of PyUnicode_READY(). (#3451)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e583e27..5dd7cd9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5017,13 +5017,16 @@ import_all_from(PyObject *locals, PyObject *v) PyErr_Clear(); break; } - if (skip_leading_underscores && - PyUnicode_Check(name) && - PyUnicode_READY(name) != -1 && - PyUnicode_READ_CHAR(name, 0) == '_') - { - Py_DECREF(name); - continue; + if (skip_leading_underscores && PyUnicode_Check(name)) { + if (PyUnicode_READY(name) == -1) { + Py_DECREF(name); + err = -1; + break; + } + if (PyUnicode_READ_CHAR(name, 0) == '_') { + Py_DECREF(name); + continue; + } } value = PyObject_GetAttr(v, name); if (value == NULL) |