From e3b2b4b8d9e751b49e3550cb83ba39b54fdc377c Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 8 Sep 2017 09:58:51 +0300 Subject: bpo-31393: Fix the use of PyUnicode_READY(). (#3451) --- Objects/codeobject.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Objects/codeobject.c') diff --git a/Objects/codeobject.c b/Objects/codeobject.c index eee9bfeaf7..adef625b29 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); -- cgit v1.2.1