commit | 3ab4f651b906e47650c6b6de94ae23da08db4f58 | [log] [tgz] |
---|---|---|
author | Christian Heimes <christian@cheimes.de> | Fri Nov 09 01:27:29 2007 +0000 |
committer | Christian Heimes <christian@cheimes.de> | Fri Nov 09 01:27:29 2007 +0000 |
tree | a3925664a0898658f0fadb843b145e3d6c1eb90c | |
parent | 939336d7d47cd22c96e1220a6895c897167dd5f7 [diff] [blame] |
seek() has to accept any int-like number
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 @@ 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: