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 /Objects/codeobject.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 'Objects/codeobject.c')
-rw-r--r-- | Objects/codeobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index eee9bfe..adef625 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -27,7 +27,7 @@ all_name_chars(PyObject *o) }; const unsigned char *s, *e; - if (PyUnicode_READY(o) == -1 || !PyUnicode_IS_ASCII(o)) + if (!PyUnicode_IS_ASCII(o)) return 0; s = PyUnicode_1BYTE_DATA(o); @@ -63,6 +63,10 @@ intern_string_constants(PyObject *tuple) for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); if (PyUnicode_CheckExact(v)) { + if (PyUnicode_READY(v) == -1) { + PyErr_Clear(); + continue; + } if (all_name_chars(v)) { PyObject *w = v; PyUnicode_InternInPlace(&v); |