]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyUnicode_FromObject() ensures that its output is a ready string
authorVictor Stinner <victor.stinner@haypocalc.com>
Sat, 1 Oct 2011 01:09:33 +0000 (03:09 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sat, 1 Oct 2011 01:09:33 +0000 (03:09 +0200)
Objects/unicodeobject.c

index a26fd2f68b649231010f60149054c529f0d743e6..fed2cc9fb4f0faa1518e2094b23d0f6f0a2ff8b7 100644 (file)
@@ -2068,6 +2068,8 @@ PyUnicode_FromObject(register PyObject *obj)
     /* XXX Perhaps we should make this API an alias of
        PyObject_Str() instead ?! */
     if (PyUnicode_CheckExact(obj)) {
+        if (PyUnicode_READY(obj))
+            return NULL;
         Py_INCREF(obj);
         return obj;
     }