]> granicus.if.org Git - python/commit
The changes to the stateful codecs in 2.4 resulted in StreamReader.readline()
authorWalter Dörwald <walter@livinglogic.de>
Tue, 21 Dec 2004 22:24:00 +0000 (22:24 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Tue, 21 Dec 2004 22:24:00 +0000 (22:24 +0000)
commite57d7b179a6171b013030c6751e8c0999251200b
tree073cb21af5f7c6a2cb4c6e9044207d4f483cd3cf
parentdcba6622f52efafa28104a07db9d5ba2b1a8d628
The changes to the stateful codecs in 2.4 resulted in StreamReader.readline()
trying to return a complete line even if a size parameter was given (see
http://www.python.org/sf/1076985). This leads to buffer overflows with long
source lines under Windows if e.g. cp1252 is used as the source encoding.
This patch reverts the behaviour of readline() to something that behaves more
like Python 2.3: If a size parameter is given, read() is called only once.

As a side effect of this, readline() now supports all types of linebreaks
supported by unicode.splitlines().

Note that the tokenizer is still broken and it's possible to provoke segfaults
(see http://www.python.org/sf/1089395).
Lib/codecs.py
Lib/test/test_codecs.py