• Walter Dörwald's avatar
    Backport checkin: · d0e18e48
    Walter Dörwald yazdı
    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).
    d0e18e48
codecs.py 22.6 KB