]> granicus.if.org Git - python/commitdiff
Martijn Pieters convinced me that when readline() strips the trailing
authorGuido van Rossum <guido@python.org>
Fri, 5 Oct 2001 21:22:21 +0000 (21:22 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 5 Oct 2001 21:22:21 +0000 (21:22 +0000)
newline from a multifile part, it should also strip a trailing \r\n.

Lib/multifile.py

index 47e2346978a9ffac2ff0e289f884f67a04bd8a51..ff7dbf6b14b39dd262d537f059301cf965ef9061 100644 (file)
@@ -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):