Author vstinner
Recipients cassava, famart, ggenellina, ocean-city, pitrou, r_mosaic, vstinner
Date 2011-07-07.21:37:32
SpamBayes Score 1.64191e-09
Marked as misclassified No
Message-id <1310074654.04.0.570155390003.issue5505@psf.upfronthosting.co.za>
In-reply-to
Content
> 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)?
History
Date User Action Args
2011-07-07 21:37:34vstinnersetrecipients: + vstinner, ggenellina, pitrou, ocean-city, r_mosaic, cassava, famart
2011-07-07 21:37:34vstinnersetmessageid: <1310074654.04.0.570155390003.issue5505@psf.upfronthosting.co.za>
2011-07-07 21:37:33vstinnerlinkissue5505 messages
2011-07-07 21:37:32vstinnercreate