From: Guido van Rossum Date: Fri, 5 Oct 2001 21:22:21 +0000 (+0000) Subject: Martijn Pieters convinced me that when readline() strips the trailing X-Git-Tag: v2.2.1c1~1436 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=39c785108f1acddb70930edf023825f935aa640e;p=thirdparty%2FPython%2Fcpython.git Martijn Pieters convinced me that when readline() strips the trailing newline from a multifile part, it should also strip a trailing \r\n. --- diff --git a/Lib/multifile.py b/Lib/multifile.py index 47e2346978a9..ff7dbf6b14b3 100644 --- a/Lib/multifile.py +++ b/Lib/multifile.py @@ -76,8 +76,11 @@ class MultiFile: line = self.readahead if line: self.readahead = self._readline() - if not self.readahead and line[-1:] == "\n": - line = line[:-1] + if not self.readahead: + if line[-2:] == "\r\n": + line = line[:-2] + elif line[-1:] == "\n": + line = line[:-1] return line def _readline(self):