Skip to content

Commit 7095ac4

Browse files
committed
Don't overallocate for bytearray()
1 parent c8ac889 commit 7095ac4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Objects/bytesobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3775,7 +3775,7 @@ byteswriter_resize(PyBytesWriter *writer, Py_ssize_t size, int overallocate)
37753775
return 0;
37763776
}
37773777

3778-
if (overallocate) {
3778+
if (overallocate && !writer->use_bytearray) {
37793779
if (size <= (PY_SSIZE_T_MAX - size / OVERALLOCATE_FACTOR)) {
37803780
size += size / OVERALLOCATE_FACTOR;
37813781
}

0 commit comments

Comments
 (0)