We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 306b8f6 commit d71b3a5Copy full SHA for d71b3a5
Python/codecs.c
@@ -739,9 +739,7 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
739
}
740
assert(slen == 0 || PyUnicode_KIND(res) == PyUnicode_2BYTE_KIND);
741
Py_UCS2 *outp = PyUnicode_2BYTE_DATA(res);
742
- for (Py_ssize_t i = 0; i < slen; ++i) {
743
- outp[i] = Py_UNICODE_REPLACEMENT_CHARACTER;
744
- }
+ memset(outp, Py_UNICODE_REPLACEMENT_CHARACTER, sizeof(Py_UCS2) * slen);
745
assert(_PyUnicode_CheckConsistency(res, 1));
746
return Py_BuildValue("(Nn)", res, end);
747
0 commit comments