Matthew Barnett <pyt...@mrabarnett.plus.com> added the comment:
It can be shortened to this: buffer = b"a" * 8191 + b"\\r\\n" with open("bug_csv.csv", "wb") as f: f.write(buffer) with open("bug_csv.csv", encoding="unicode_escape", newline="") as f: f.readline() To me it looks like it's reading in blocks of 8K and then decoding them, but it isn't correctly handling an escape sequence that happens to cross a block boundary. ---------- nosy: +mrabarnett _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45461> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com