summaryrefslogtreecommitdiff
path: root/Python/codecs.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-02 19:00:15 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-02 19:00:15 +0200
commitca68997fb8ada5c2a95caaf984f29bf02732336a (patch)
treed35b6125f3cf10f8ebfabf82d8202f8a2d3c77df /Python/codecs.c
parentabcd473113a269e89f4f27552bac26666b4c241e (diff)
downloadcpython-ca68997fb8ada5c2a95caaf984f29bf02732336a.tar.gz
PyCodec_ReplaceErrors() uses "C" format instead of "u#" to build result
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 4c2fc5d722..0008bdcbdc 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -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;