Skip to content

Commit 1a15aba

Browse files
author
Victor Stinner
committed
PyCodec_ReplaceErrors() uses "C" format instead of "u#" to build result
1 parent 0069be1 commit 1a15aba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Python/codecs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,11 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
534534
return Py_BuildValue("(Nn)", res, end);
535535
}
536536
else if (PyObject_IsInstance(exc, PyExc_UnicodeDecodeError)) {
537-
Py_UNICODE res = Py_UNICODE_REPLACEMENT_CHARACTER;
538537
if (PyUnicodeDecodeError_GetEnd(exc, &end))
539538
return NULL;
540-
return Py_BuildValue("(u#n)", &res, 1, end);
539+
return Py_BuildValue("(Cn)",
540+
(int)Py_UNICODE_REPLACEMENT_CHARACTER,
541+
end);
541542
}
542543
else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) {
543544
PyObject *res;

0 commit comments

Comments
 (0)