summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/io.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/io.py b/Lib/io.py
index d9550ae..74076d3 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -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: