PyCodec_IgnoreErrors() avoids the deprecated "u#" format
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 1 Dec 2011 01:52:11 +0000 (02:52 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 1 Dec 2011 01:52:11 +0000 (02:52 +0100)
Python/codecs.c

index cdf2c4455a3f63b979f92658e3ee4aed1ab0b503..9b0c4b2f446b9b761ad82487d909984dad75eb6a 100644 (file)
@@ -510,8 +510,7 @@ PyObject *PyCodec_IgnoreErrors(PyObject *exc)
         wrong_exception_type(exc);
         return NULL;
     }
-    /* ouch: passing NULL, 0, pos gives None instead of u'' */
-    return Py_BuildValue("(u#n)", &end, 0, end);
+    return Py_BuildValue("(Nn)", PyUnicode_New(0, 0), end);
 }