Kaydet (Commit) 3ab4f651 authored tarafından Christian Heimes's avatar Christian Heimes

seek() has to accept any int-like number

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