Skip to content

Commit 4c3c908

Browse files
committed
Document why size < 0 can happen
1 parent 56fbee3 commit 4c3c908

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Modules/_io/bytesio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ _io_BytesIO_peek_impl(bytesio *self, Py_ssize_t size)
493493
n = self->string_size - self->pos;
494494
if (size < 1 || size > n) {
495495
size = n;
496+
/* size can be negative after truncate() */
496497
if (size < 0) {
497498
size = 0;
498499
}

0 commit comments

Comments
 (0)