-
-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Labels
Description
In my opinion, throwing ValueError for seek(n, SEEK_END) on a stream_reader is incorrect. The Python io docs say (for the seek method as a whole):
Return
Trueif the stream supports random access. IfFalse,seek(),tell()andtruncate()will raise OSError.
To me, this indicates that instead of throwing ValueError, seek() should throw an OSError. This would fix an issue with passing the stream_reader to requests' data parameter, which tries to read the length of a file-like object by issuing a SEEK_END, and catching OSError or IOError to indicate that it is unsupported. Source here.
browdus