Issue 1098990: codec readline() splits lines apart (original) (raw)

Issue1098990

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/41415

classification

Title: codec readline() splits lines apart
Type: Stage:
Components: Library (Lib) Versions: Python 2.5

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, irmen
Priority: normal Keywords:

Created on 2005-01-09 16:45 by irmen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
example.txt irmen,2005-01-09 16:45 example shell session that shows the problem
Messages (3)
msg23904 - (view) Author: Irmen de Jong (irmen) (Python triager) Date: 2005-01-09 16:45
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.
msg23905 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-01-10 11:15
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.
msg23906 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-01-10 12:26
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!
History
Date User Action Args
2022-04-11 14:56:09 admin set github: 41415
2005-01-09 16:45:57 irmen create