Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3fa36ff

Browse files
committed
Issue #25318: Fix backslashreplace()
Fix code to estimate the needed space.
1 parent 797485e commit 3fa36ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ backslashreplace(_PyBytesWriter *writer, Py_ssize_t prealloc_per_char,
590590
incr = 2+4;
591591
else {
592592
assert(ch <= MAX_UNICODE);
593-
incr = 2+6;
593+
incr = 2+8;
594594
}
595595
if (size > PY_SSIZE_T_MAX - incr) {
596596
PyErr_SetString(PyExc_OverflowError,

0 commit comments

Comments
 (0)