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

gh-126004: fix positions handling in codecs.replace_errors #127674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jan 23, 2025
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
fix tests
  • Loading branch information
picnixz committed Dec 6, 2024
commit 98db6a2958548f403f8de55bdc442f64c695b1a6
4 changes: 3 additions & 1 deletion Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,9 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
}
assert(PyUnicode_KIND(res) == PyUnicode_2BYTE_KIND);
Py_UCS2 *outp = PyUnicode_2BYTE_DATA(res);
memset(outp, (int)Py_UNICODE_REPLACEMENT_CHARACTER, len);
for (Py_ssize_t i = 0; i < len; ++i) {
outp[i] = Py_UNICODE_REPLACEMENT_CHARACTER;
}
assert(_PyUnicode_CheckConsistency(res, 1));
return Py_BuildValue("(Nn)", res, end);
}
Expand Down
Loading
0