[Python-checkins] cpython: PyUnicode_DecodeUTF8 will always return a ready string

benjamin.peterson python-checkins at python.org
Mon Jan 16 15:49:28 CET 2012


http://hg.python.org/cpython/rev/f5214817ed57
changeset:   74443:f5214817ed57
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon Jan 16 09:47:42 2012 -0500
summary:
  PyUnicode_DecodeUTF8 will always return a ready string

files:
  Python/ast.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Python/ast.c b/Python/ast.c
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -532,8 +532,9 @@
 {
     _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) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list