Skip to content

Commit 3661b65

Browse files
committed
Document why size < 0 can happen
1 parent 3e51adb commit 3661b65

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Modules/_io/bytesio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ _io_BytesIO_peek_impl(bytesio *self, Py_ssize_t size)
530530
n = self->string_size - self->pos;
531531
if (size < 1 || size > n) {
532532
size = n;
533+
/* size can be negative after truncate() */
533534
if (size < 0) {
534535
size = 0;
535536
}

0 commit comments

Comments
 (0)