STINNER Victor <victor.stin...@haypocalc.com> added the comment:

> I don't know if something changed in Python 3.3, or ...

Yes, something changed in Python 3.3. I fixed this issue "by mistake" :-) The 
fix is the following commit:

New changeset 3c7792ec4547 by Victor Stinner in branch 'default':
Issue #12175: BufferedReader.read(-1) now calls raw.readall() if available.
http://hg.python.org/cpython/rev/3c7792ec4547

It is a bug in BufferedReader, a bug or an unexpected behaviour. Before this 
commit (e.g. in Python 3.2.0), BufferedReader.read(-1) calls raw.read() two 
times for this issue: the first call returns an non empty string (the string 
until the first ^Z), the second call returns an empty string (the string until 
the second ^Z). BufferedReader.read(-1) loop ends with raw.read() returns an 
empty string.

You can workaround this issue by calling sys.stdin.buffer.raw.readall() or 
sys.stdin.buffer.raw.read(-1).

I chose to not port my BufferedRead.read(-1) fix (call raw.readall() if 
available) in Python 3.2 because it changes the behaviour, and I don't want to 
do that in a minor release.

Is anyone in favor of changing the behaviour of BufferedRead.read(-1) in a 
minor release (next 2.7.3 and 3.2.2)? Or can I close the issue (the bug is 
already fixed in Python 3.3)?

----------

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

Reply via email to