Skip to content

Commit 65e90a6

Browse files
committed
Fix test_codeccallbacks
1 parent ecdece1 commit 65e90a6

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Objects/stringlib/codecs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode,
387387
goto error;
388388

389389
if (newpos < startpos) {
390+
writer->overallocate = 1;
390391
p = PyBytesWriter_GrowAndUpdatePointer(writer,
391392
max_char_size * (startpos - newpos),
392393
p);

Objects/unicodeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7453,6 +7453,7 @@ unicode_encode_ucs1(PyObject *unicode,
74537453
goto onError;
74547454

74557455
if (newpos < collstart) {
7456+
writer->overallocate = 1;
74567457
str = PyBytesWriter_GrowAndUpdatePointer(writer,
74577458
collstart - newpos,
74587459
str);

0 commit comments

Comments
 (0)