[ python-Bugs-1098990 ] codec readline() splits lines apart

SourceForge.net noreply at sourceforge.net
Mon Jan 10 13:26:48 CET 2005


Bugs item #1098990, was opened at 2005-01-09 17:45
Message generated for change (Comment added) made by doerwalter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1098990&group_id=5470

Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Irmen de Jong (irmen)
Assigned to: Nobody/Anonymous (nobody)
Summary: codec readline() splits lines apart

Initial Comment:
It seems that the fix for bug 1076985 (Incorrect
behaviour of StreamReader.readline leads to crash) has
introduced a new bug.
using current cvs Python on Linux, I observe faulty
behavior of the readline() method on file-like objects
returned from the codecs module.
See the attached example.txt.
The readline() breaks certain lines in half.
It only happens when a certain encoding is used, so regular
file objects behave as expected. Also, readlines()
works fine.


----------------------------------------------------------------------

>Comment By: Walter Dörwald (doerwalter)
Date: 2005-01-10 13:26

Message:
Logged In: YES 
user_id=89016

Checked in as:
Lib/codecs.py 1.37
Lib/test/test_codecs.py 1.18
Lib/codecs.py 1.35.2.2
Lib/test/test_codecs.py 1.15.2.2

Thanks for the report!

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2005-01-10 12:15

Message:
Logged In: YES 
user_id=89016

The problem is that the first readline() reads more than the
first line, returns the first line and puts back the rest
for the next read. The next call to readline() discovers
that there is already data there and doesn't call read()
again. I'm working on a patch.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1098990&group_id=5470


More information about the Python-bugs-list mailing list