8000 gh-126004: fix positions handling in `codecs.replace_errors` by picnixz · Pull Request #127674 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unnecessary cast and comment
  • Loading branch information
picnixz committed Jan 22, 2025
commit 306b8f6dcc52282023f5d200b8042f37ef2cf5f7
3 changes: 1 addition & 2 deletions Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,11 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
}
assert(PyUnicode_KIND(res) == PyUnicode_1BYTE_KIND);
Py_UCS1 *outp = PyUnicode_1BYTE_DATA(res);
memset(outp, (int)'?', sizeof(Py_UCS1) * slen);
memset(outp, '?', sizeof(Py_UCS1) * slen);
assert(_PyUnicode_CheckConsistency(res, 1));
return Py_BuildValue("(Nn)", res, end);
}
else if (PyObject_TypeCheck(exc, (PyTypeObject *)PyExc_UnicodeDecodeError)) {
// _PyUnicodeError_GetParams() is slightly faster than the public getter
if (_PyUnicodeError_GetParams(exc, NULL, NULL,
NULL, &end, NULL, true) < 0) {
return NULL;
Expand Down
Loading
0