Skip to content

Commit 04372bd

Browse files
committed
Do not update pos if peek_bytes failed
1 parent cd40d77 commit 04372bd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Modules/_io/bytesio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ static PyObject *
451451
read_bytes_lock_held(bytesio *self, Py_ssize_t size)
452452
{
453453
PyObject *bytes = peek_bytes_lock_held(self, size);
454-
self->pos += size;
454+
if (bytes != NULL) {
455+
self->pos += size;
456+
}
455457
return bytes;
456458
}
457459

0 commit comments

Comments
 (0)