Commit 3ab4f651 authored by Christian Heimes's avatar Christian Heimes

seek() has to accept any int-like number

parent 939336d7
......@@ -694,8 +694,10 @@ class BytesIO(BufferedIOBase):
return n
def seek(self, pos, whence=0):
if not isinstance(pos, int):
raise TypeError("an integer is required")
try:
pos = pos.__index__()
except AttributeError as err:
raise TypeError("an integer is required") from err
if whence == 0:
self._pos = max(0, pos)
elif whence == 1:
......
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