]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyCodec_ReplaceErrors() uses "C" format instead of "u#" to build result
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 2 Oct 2011 17:00:15 +0000 (19:00 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 2 Oct 2011 17:00:15 +0000 (19:00 +0200)
Python/codecs.c

index 4c2fc5d722fe7c66efb96144ea22085139b7671e..0008bdcbdca76dc3f7e2258e555bc6a91856e08c 100644 (file)
@@ -534,10 +534,11 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
         return Py_BuildValue("(Nn)", res, end);
     }
     else if (PyObject_IsInstance(exc, PyExc_UnicodeDecodeError)) {
-        Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER;
         if (PyUnicodeDecodeError_GetEnd(exc, &end))
             return NULL;
-        return Py_BuildValue("(u#n)", &res, 1, end);
+        return Py_BuildValue("(Cn)",
+                             (int)Py_UNICODE_REPLACEMENT_CHARACTER,
+                             end);
     }
     else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) {
         PyObject *res;