Skip to content

Commit 39951be

Browse files
committed
Revert "use memset instead of a for-loop"
This reverts commit d71b3a5.
1 parent d71b3a5 commit 39951be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Python/codecs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,9 @@ PyObject *PyCodec_ReplaceErrors(PyObject *exc)
739739
}
740740
assert(slen == 0 || PyUnicode_KIND(res) == PyUnicode_2BYTE_KIND);
741741
Py_UCS2 *outp = PyUnicode_2BYTE_DATA(res);
742-
memset(outp, Py_UNICODE_REPLACEMENT_CHARACTER, sizeof(Py_UCS2) * slen);
742+
for (Py_ssize_t i = 0; i < slen; ++i) {
743+
outp[i] = Py_UNICODE_REPLACEMENT_CHARACTER;
744+
}
743745
assert(_PyUnicode_CheckConsistency(res, 1));
744746
return Py_BuildValue("(Nn)", res, end);
745747
}

0 commit comments

Comments
 (0)