Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8130f7c

Browse files
committed
Fixed the negative value check in io._BytesIO.seek().
1 parent 10dfc1e commit 8130f7c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,9 +831,9 @@ def seek(self, pos, whence=0):
831831
except AttributeError as err:
832832
raise TypeError("an integer is required") from err
833833
if whence == 0:
834-
self._pos = max(0, pos)
835834
if pos < 0:
836835
raise ValueError("negative seek position %r" % (pos,))
836+
self._pos = max(0, pos)
837837
elif whence == 1:
838838
self._pos = max(0, self._pos + pos)
839839
elif whence == 2:

0 commit comments

Comments
 (0)