Serhiy Storchaka added the comment:

I doubt we can use io.BufferedReader or handmade buffering here. Current code 
doesn't read more bytes than necessary. Buffered reader will read ahead, and 
there is no way to return read bytes back to the stream in general case (an 
exception is seekable streams). It can be blocked in attempt to fill a buffer 
with unnecessary bytes.

I think that the user of the cgi module is responsible for wrapping a stream in 
io.BufferedReader (if it is acceptable), the cgi module shouldn't do this 
itself.

But we can implement special cases for buffered or seekable streams. However 
this optimization will not work in general case (e.g. for stdin or socket).

----------
keywords:  -easy
stage: patch review -> needs patch

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

Reply via email to