[Python-3000-checkins] r58919 - python/branches/py3k/Lib/io.py
christian.heimes
python-3000-checkins at python.org
Fri Nov 9 02:27:29 CET 2007
Author: christian.heimes
Date: Fri Nov 9 02:27:29 2007
New Revision: 58919
Modified:
python/branches/py3k/Lib/io.py
Log:
seek() has to accept any int-like number
Modified: python/branches/py3k/Lib/io.py
==============================================================================
--- python/branches/py3k/Lib/io.py (original)
+++ python/branches/py3k/Lib/io.py Fri Nov 9 02:27:29 2007
@@ -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:
More information about the Python-3000-checkins
mailing list