[issue8260] When I use codecs.open(...) and f.readline() follow up by f.read() return bad result

Amaury Forgeot d'Arc report at bugs.python.org
Wed Mar 31 12:00:21 CEST 2010


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

Buffering applies when writing, not when reading a file.

There is indeed a problem in codecs.py: after a readline(), read() will return the content of the internal buffer, and not more.

The "size" parameter is a hint, and should not be used to decide whether the character buffer is enough to satisfy the read() request.
Patch is attached, with test.

----------
keywords: +patch
nosy: +amaury.forgeotdarc
stage: test needed -> patch review
Added file: http://bugs.python.org/file16705/codecs_read.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8260>
_______________________________________


More information about the Python-bugs-list mailing list