[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Nikolaus Rath
Nikolaus Rath added the comment: On 07/24/2013 03:04 PM, Antoine Pitrou wrote: > However, 3.2 didn't get that improvement, sorry. See changeset 27bf3d0b8e5f > and issue #13393. > > -- > resolution: -> duplicate > status: open -> closed Duh. So much back and forth just to find it's alr

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- superseder: -> Improve BufferedReader.read1() ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, well. This is already fixed, then: Python 3.4.0a0 (default:ae769deb45b2, Jul 20 2013, 19:28:41) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> raw = io.BytesIO(bytes(200)) >>> buffered = io.Buff

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Nikolaus Rath
Nikolaus Rath added the comment: On 07/24/2013 02:51 PM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Le mercredi 24 juillet 2013 à 21:45 +, Nikolaus Rath a écrit : >> The documentation is correct that read1(n) never returns more than n bytes. >> >> My complaint is that t

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le mercredi 24 juillet 2013 à 21:45 +, Nikolaus Rath a écrit : > The documentation is correct that read1(n) never returns more than n bytes. > > My complaint is that the actual bound is stricter than this, band > read1(n) will never return more than min(n, b

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le mercredi 24 juillet 2013 à 21:51 +, Antoine Pitrou a écrit : > - if the buffer is empty, 1 raw I/O call is issued and at most 1 byte is > returned Make that "at most n bytes are returned", of course. -- ___ Py

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Nikolaus Rath
Nikolaus Rath added the comment: On 07/24/2013 02:28 PM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Le mercredi 24 juillet 2013 à 18:24 +, Nikolaus Rath a écrit : >> There should be no problem reading 20 bytes with a single call to >> BytesIO.read(), yet the buffered re

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le mercredi 24 juillet 2013 à 18:24 +, Nikolaus Rath a écrit : > There should be no problem reading 20 bytes with a single call to > BytesIO.read(), yet the buffered reader returns only 10 bytes. Er. Your bug report seems to imply that read1(n) can return *m

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Nikolaus Rath
Nikolaus Rath added the comment: On 07/24/2013 07:35 AM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > >> This means that read1() will only return up to n bytes if n is smaller >> than the buffer size, otherwise it will return at most >> bytes. > > Did you actually observe suc

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: > This means that read1() will only return up to n bytes if n is smaller > than the buffer size, otherwise it will return at most > bytes. Did you actually observe such behaviour? If so, this is a bug. -- ___ Python

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-24 Thread R. David Murray
R. David Murray added the comment: Unless I'm misunderstanding something, the current implementation does match the current documentation: if < n, returning bytes is returning "up to n". "Up to" means it could be "less than". So you are advocating a change in behavior...but I believe there

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +benjamin.peterson, hynek, pitrou, serhiy.storchaka, stutzbach ___ Python tracker ___ ___ Pytho

[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-21 Thread Nikolaus Rath
New submission from Nikolaus Rath: The read1() docstring says: "Reads up to n bytes, with at most one read() system call." However, in the implementation read1() calls peek() to refill the buffer if necessary, and then returns whatever is available in the buffer. This means that read1() will