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 Dolda2000, benjamin.peterson, hynek, martin.panter, pitrou, python-dev, r.david.murray, serhiy.storchaka, stutzbach
Date 2016-08-21.01:42:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471743751.63.0.927160763341.issue20074@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, the documentation for TextIOWrapper says it is “a buffered text stream over a BufferedIOBase binary stream.” If passing a RawIOBase (buffering=0) file works, that seems like an undocumented accident. This is also explicitly disallowed with open(). “Pass 0 to switch buffering off (only allowed in binary mode)”:

>>> open("/dev/tty", "r+t", buffering=0)
ValueError: can't have unbuffered text I/O

One benefit of requiring "r+b" mode to be seekable is that if you open a pipe for random access, it reports the error immediately, rather than after you have half written your data and then try to seek(). But I admit this difference between buffered=0 mode and random-access mode is obscure.

Given that seeking text streams is rather obscure (Issue 25849), and there are sometimes problems in conjunction with writing (Issue 12215) and with truncating (Issue 26158), it could make some sense to use BufferedRWPair in text mode. But IMO open() is already too complicated, so I am not excited about such a change.
History
Date User Action Args
2016-08-21 01:42:31martin.pantersetrecipients: + martin.panter, pitrou, benjamin.peterson, stutzbach, r.david.murray, python-dev, hynek, serhiy.storchaka, Dolda2000
2016-08-21 01:42:31martin.pantersetmessageid: <1471743751.63.0.927160763341.issue20074@psf.upfronthosting.co.za>
2016-08-21 01:42:31martin.panterlinkissue20074 messages
2016-08-21 01:42:30martin.pantercreate