summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-09 01:27:29 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-09 01:27:29 (GMT)
commit3ab4f651b906e47650c6b6de94ae23da08db4f58 (patch)
treea3925664a0898658f0fadb843b145e3d6c1eb90c
parent939336d7d47cd22c96e1220a6895c897167dd5f7 (diff)
downloadcpython-3ab4f651b906e47650c6b6de94ae23da08db4f58.zip
cpython-3ab4f651b906e47650c6b6de94ae23da08db4f58.tar.gz
cpython-3ab4f651b906e47650c6b6de94ae23da08db4f58.tar.bz2
seek() has to accept any int-like number
-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: