]> granicus.if.org Git - python/commitdiff
PyUnicode_AsUTF32String() calls directly _PyUnicode_EncodeUTF32(),
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 20 Nov 2011 18:12:52 +0000 (19:12 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 20 Nov 2011 18:12:52 +0000 (19:12 +0100)
instead of calling the deprecated PyUnicode_EncodeUTF32() function

Objects/unicodeobject.c

index 9c1705d0dd9f4dff41c208309acba34a70c417e4..7aa5ff0e1a32f3511f5c41813096cffd8db52c41 100644 (file)
@@ -5150,12 +5150,7 @@ PyUnicode_EncodeUTF32(const Py_UNICODE *s,
 PyObject *
 PyUnicode_AsUTF32String(PyObject *unicode)
 {
-    const Py_UNICODE *wstr;
-    Py_ssize_t wlen;
-    wstr = PyUnicode_AsUnicodeAndSize(unicode, &wlen);
-    if (wstr == NULL)
-        return NULL;
-    return PyUnicode_EncodeUTF32(wstr, wlen, NULL, 0);
+    return _PyUnicode_EncodeUTF32(unicode, NULL, 0);
 }
 
 /* --- UTF-16 Codec ------------------------------------------------------- */