Commit 8130f7c3 authored by Alexandre Vassalotti's avatar Alexandre Vassalotti

Fixed the negative value check in io._BytesIO.seek().

parent 10dfc1ee
......@@ -831,9 +831,9 @@ class _BytesIO(BufferedIOBase):
except AttributeError as err:
raise TypeError("an integer is required") from err
if whence == 0:
self._pos = max(0, pos)
if pos < 0:
raise ValueError("negative seek position %r" % (pos,))
self._pos = max(0, pos)
elif whence == 1:
self._pos = max(0, self._pos + pos)
elif whence == 2:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment