mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Martijn Pieters convinced me that when readline() strips the trailing
newline from a multifile part, it should also strip a trailing \r\n.
This commit is contained in:
parent
9475a2310d
commit
39c785108f
1 changed files with 5 additions and 2 deletions
|
@ -76,8 +76,11 @@ class MultiFile:
|
||||||
line = self.readahead
|
line = self.readahead
|
||||||
if line:
|
if line:
|
||||||
self.readahead = self._readline()
|
self.readahead = self._readline()
|
||||||
if not self.readahead and line[-1:] == "\n":
|
if not self.readahead:
|
||||||
line = line[:-1]
|
if line[-2:] == "\r\n":
|
||||||
|
line = line[:-2]
|
||||||
|
elif line[-1:] == "\n":
|
||||||
|
line = line[:-1]
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def _readline(self):
|
def _readline(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue