mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
|
||||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue