This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients josh.r, martin.panter
Date 2015-06-02.05:34:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433223256.26.0.243057295509.issue24358@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-06-02 05:34:16martin.pantersetrecipients: + martin.panter, josh.r
2015-06-02 05:34:16martin.pantersetmessageid: <1433223256.26.0.243057295509.issue24358@psf.upfronthosting.co.za>
2015-06-02 05:34:16martin.panterlinkissue24358 messages
2015-06-02 05:34:15martin.pantercreate