]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Fix for SF bug #1175396: readline() will now read one more character, if
authorWalter Dörwald <walter@livinglogic.de>
Mon, 4 Apr 2005 21:38:47 +0000 (21:38 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Mon, 4 Apr 2005 21:38:47 +0000 (21:38 +0000)
commit7a6dc139de385efaa70c43cc9a915239dbfeea1e
tree89604210eb63ce7f69954a00e1789a07f364f94f
parentcf18a5d67bc791f7273b7577797f04470e01e42e
Fix for SF bug #1175396: readline() will now read one more character, if
the last character read is "\r" (and size is None, i.e. we're allowed to
call read() multiple times), so that we can return the correct line ending
(this additional character might be a "\n").

If the stream is temporarily exhausted, we might return the wrong line ending
(if the last character read is "\r" and the next one (after the byte stream
provides more data) is "\n", but at least the atcr member ensure that we
get the correct number of lines (i.e. this "\n" will not be treated as
another line ending.)
Lib/codecs.py
Lib/test/test_codecs.py