This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: StreamReader.readline with size reading multiple lines
Type: Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: doerwalter Nosy List: doerwalter, donut, georg.brandl
Priority: normal Keywords: patch

Created on 2005-12-13 08:54 by donut, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
python-StreamReader-readline-with-size.diff donut, 2005-12-13 08:54 simple fix and test patch
Messages (3)
msg49193 - (view) Author: Matthew Mueller (donut) Date: 2005-12-13 08:54
In Python 2.4.2 and trunk, when StreamReader.readline
is used with a size argument, it will eventually
truncate some lines, even if every line is less than
the size.  It works correctly in Python 2.3.5, I
haven't tried other versions.

>>> f.readline(8)
>>> f.readline(8)
>>> f.readline(8)

I've attached a patch which fixes this and modifies to test this.  I don't know if this is
the best way to fix it, but I didn't want to make
deeper changes to the caching mechanism, being
unfamiliar with this code.
msg49194 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-01-20 17:32
Logged In: YES 

Confirmed here (2.5 HEAD, Linux box). Patch works.

msg49195 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2006-03-06 22:57
Logged In: YES 

Checked in another fix as r42872 and r42873: Instead of
calling read() with a chars argument read() reads from the
byte stream, if less then size chars are in the charbuffer.
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42685
2005-12-13 08:54:29donutcreate