mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fixed bug #1081: file.seek allows float arguments
This commit is contained in:
parent
8bd14fb398
commit
8e42a0a0e0
3 changed files with 10 additions and 0 deletions
|
@ -694,6 +694,8 @@ class BytesIO(BufferedIOBase):
|
|||
return n
|
||||
|
||||
def seek(self, pos, whence=0):
|
||||
if not isinstance(pos, int):
|
||||
raise TypeError("an integer is required")
|
||||
if whence == 0:
|
||||
self._pos = max(0, pos)
|
||||
elif whence == 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue