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
Revert "use memset instead of a for-loop"
This reverts commit d71b3a5.
  • Loading branch information
picnixz committed Jan 22, 2025
commit 39951be5d9c84171ad1e6200f09b807933c5662a
4 changes: 3 additions & 1 deletion Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,9 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
}
assert(slen == 0 || PyUnicode_KIND(res) == PyUnicode_2BYTE_KIND);
Py_UCS2 *outp = PyUnicode_2BYTE_DATA(res);
memset(outp, Py_UNICODE_REPLACEMENT_CHARACTER, sizeof(Py_UCS2) * slen);
for (Py_ssize_t i = 0; i < slen; ++i) {
outp[i] = Py_UNICODE_REPLACEMENT_CHARACTER;
}
assert(_PyUnicode_CheckConsistency(res, 1));
return Py_BuildValue("(Nn)", res, end);
}
Expand Down