[New-bugs-announce] [issue10344] codecs.readline doesn't care buffering=0

Santiago Piccinini report at bugs.python.org
Sun Nov 7 00:00:18 CET 2010


New submission from Santiago Piccinini <gringotumadre at gmail.com>:

codecs.readline has an internal buffer of 72 chars so calling codecs.open with buffering=0 doesn't work as expected although buffering is passed to the underlying __builtin__.open call.

Example session:

Python 3.2a3+ (py3k, Nov  6 2010, 16:17:14) 
[GCC 4.5.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> f = codecs.open("foo.txt", "w", "utf-8")
>>> word = "bar\n"
>>> content = word * 1000
>>> f.write(content)
>>> f.close()
>>> f = codecs.open("foo.txt", "rb", "utf-8", buffering=0)
>>> f.readline()
'bar\n'
>>> f.tell()
72

----------
components: Library (Lib)
messages: 120652
nosy: Santiago.Piccinini
priority: normal
severity: normal
status: open
title: codecs.readline doesn't care buffering=0
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

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


More information about the New-bugs-announce mailing list