Issue 13393: Improve BufferedReader.read1() - Python tracker (original) (raw)
The main current user of BufferedReader.read1() is TextIOWrapper. In this context, read1() is used to signal that we want to bypass binary buffering as much as possible, since TextIOWrapper does its own buffering. The current read1() implementation is therefore suboptimal: it copies data around, and limits the number of bytes that you're allowed to get in one call (even if the raw stream would satisfy more).
Attached patch improves read1() in this respect. Also, a separate modification of TextIOWrapper is needed to take advantage of it, which I will attach in another patch.