summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-05 21:22:21 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-05 21:22:21 (GMT)
commit39c785108f1acddb70930edf023825f935aa640e (patch)
tree1454b8a04758c71b59a76c74211a1dfd67554429
parent9475a2310d9cdec4b4c36dee8bf30c72605ae928 (diff)
downloadcpython-39c785108f1acddb70930edf023825f935aa640e.zip
cpython-39c785108f1acddb70930edf023825f935aa640e.tar.gz
cpython-39c785108f1acddb70930edf023825f935aa640e.tar.bz2
Martijn Pieters convinced me that when readline() strips the trailing
newline from a multifile part, it should also strip a trailing \r\n.
-rw-r--r--Lib/multifile.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/multifile.py b/Lib/multifile.py
index 47e2346..ff7dbf6 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):