You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileIO.seekable() is incorrect if determined by an invalid seek call #159677
While working on concurrency fixes for FileIO, I discovered an edge case (quite rare...) that makes seekable incorrect if determined by a call to seek that results in an error.
Reproducer
f=io.FileIO(tempfile.mktemp(), 'w+')
f.seek(-1) # OSError: [Errno 22] Invalid argumentf.seekable() # False but it should be true
The problem comes from this part of the implementation for seek, which sets seekable regardless of what the problem was (which could be that the file indeed is not seekable, or that in our example the passed offset was not valid).
changed the title [-]`FileIO`'s `seekable` is incorrect if determined by an invalid `seek` call[/-][+]`FileIO.seekable()` is incorrect if determined by an invalid `seek` call[/+]on Oct 18, 2026
Activity
[-]`FileIO`'s `seekable` is incorrect if determined by an invalid `seek` call[/-][+]`FileIO.seekable()` is incorrect if determined by an invalid `seek` call[/+]