]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyUnicode_DecodeUTF8 will always return a ready string
authorBenjamin Peterson <benjamin@python.org>
Mon, 16 Jan 2012 14:47:42 +0000 (09:47 -0500)
committerBenjamin Peterson <benjamin@python.org>
Mon, 16 Jan 2012 14:47:42 +0000 (09:47 -0500)
Python/ast.c

index 3440308ea9d8246879cf39d8cbe0da7cb7b46562..df2c63da1b689efafa1019b94707dce589abffec 100644 (file)
@@ -532,8 +532,9 @@ new_identifier(const char* n, PyArena *arena)
 {
     _Py_IDENTIFIER(normalize);
     PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
-    if (!id || PyUnicode_READY(id) == -1)
+    if (!id)
         return NULL;
+    assert(PyUnicode_IS_READY(id));
     /* Check whether there are non-ASCII characters in the
        identifier; if so, normalize to NFKC. */
     if (PyUnicode_MAX_CHAR_VALUE((PyUnicodeObject *)id) >= 128) {