Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0e41628 + 8861494 commit 69a06ddCopy full SHA for 69a06dd
1 file changed
Lib/mailbox.py
@@ -1447,10 +1447,17 @@ def _install_message(self, message):
1447
else:
1448
break
1449
while True:
1450
- buffer = message.read(4096) # Buffer size is arbitrary.
1451
- if not buffer:
+ line = message.readline()
+ if not line:
1452
1453
- self._file.write(buffer.replace(b'\n', linesep))
+ # Universal newline support.
1454
+ if line.endswith(b'\r\n'):
1455
+ line = line[:-2] + linesep
1456
+ elif line.endswith(b'\r'):
1457
+ line = line[:-1] + linesep
1458
+ elif line.endswith(b'\n'):
1459
1460
+ self._file.write(line)
1461
1462
raise TypeError('Invalid message type: %s' % type(message))
1463
stop = self._file.tell()
0 commit comments