Serhiy Storchaka added the comment: On other hand, may be the behavior of io.StringIO is wrong. Because it is different from io.TextIOWrapper.
>>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm')).readlines() ['abc\n', 'def\n', 'ghi\n', 'klm'] >>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), >>> newline=None).readlines() ['abc\n', 'def\n', 'ghi\n', 'klm'] >>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), >>> newline='').readlines() ['abc\r\n', 'def\n', 'ghi\r', 'klm'] >>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), >>> newline='\n').readlines() ['abc\r\n', 'def\n', 'ghi\rklm'] >>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), >>> newline='\r').readlines() ['abc\r', '\ndef\nghi\r', 'klm'] >>> io.TextIOWrapper(io.BytesIO(b'abc\r\ndef\nghi\rklm'), >>> newline='\r\n').readlines() ['abc\r\n', 'def\nghi\rklm'] ---------- nosy: +benjamin.peterson, hynek, pitrou, stutzbach _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20423> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com