mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Issue #25318: Fix backslashreplace()
Fix code to estimate the needed space.
This commit is contained in:
parent
797485e101
commit
3fa36ff5e4
1 changed files with 1 additions and 1 deletions
|
@ -590,7 +590,7 @@ backslashreplace(_PyBytesWriter *writer, Py_ssize_t prealloc_per_char,
|
||||||
incr = 2+4;
|
incr = 2+4;
|
||||||
else {
|
else {
|
||||||
assert(ch <= MAX_UNICODE);
|
assert(ch <= MAX_UNICODE);
|
||||||
incr = 2+6;
|
incr = 2+8;
|
||||||
}
|
}
|
||||||
if (size > PY_SSIZE_T_MAX - incr) {
|
if (size > PY_SSIZE_T_MAX - incr) {
|
||||||
PyErr_SetString(PyExc_OverflowError,
|
PyErr_SetString(PyExc_OverflowError,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue