Martin Panter added the comment:

Also related: Issue 23740, where the HTTP client assumes it can use stat() on 
the fileno() to determine the Content-Length.

Providing fileno() on file wrapper objects like GzipFile is certainly not 
necessary, but it could be useful. For instance in the tarfile case, the 
modification time, file mode, owner user, etc may still be useful even if the 
file size isn’t.

On the other hand, fileno() is a low level operation, so maybe it should only 
have been made available on light-weight RawIOBase objects or something. Even 
for a BufferedReader/Writer or TextIOWrapper, the data read from or written to 
the Python-level file object does not match the corresponding file descriptor 
operations. You could get deadlocks, data loss, etc, due to buffering. For 
example the commented-out-code near the bottom of 
<https://bugs.python.org/review/1191964/patch/11993/43982#newcode1901>.

The subprocess module documentation only says that the streams can be “existing 
file objects”. I think it should at least be clarified to say the file objects 
are taken to represent OS-level file descriptors.

----------
nosy: +vadmium

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24358>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to