From ddb536ba7b7c6022424e39d666c3cc81772645c0 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 8 Sep 2017 10:43:54 +0300 Subject: [3.6] bpo-31393: Fix the use of PyUnicode_READY(). (GH-3451). (#3453) (cherry picked from commit e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c) --- Python/ceval.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Python') diff --git a/Python/ceval.c b/Python/ceval.c index 4aa3250cd0..2b74d0e573 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5307,13 +5307,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) -- cgit v1.2.1