Raghuram Devarakonda added the comment: I think the solution is to do the translation on a bigger chunk than on the string being returned in each read call. For example, the following patch correctly returns "a" and "\n" (instead of "a" and two "\n"s).
Index: Lib/io.py =================================================================== --- Lib/io.py (revision 58874) +++ Lib/io.py (working copy) @@ -1253,8 +1253,9 @@ res += pending if not readahead: break + res = self._replacenl(res) self._pending = res[n:] - return self._replacenl(res[:n]) + return res[:n] def __next__(self): self._telling = False ----------------- Of course, we need to take care of the case when the last character in "res" is "\r" to be followed by "\n" in the next read. I just wanted to see if I am on the right track and if so, I can spend more time on this. ---------- nosy: +draghuram __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com