Avoid making a fresh slice of the whole email on each iteration.

An update to yesterday's patch. Should avoid copying the mail byte
string more than once.

Tested on Python 2.7 and 3.6.
This commit is contained in:
Jonathan Bastien-Filiatrault
2018-12-12 13:40:55 -05:00
parent 903cc902d9
commit 882d14c514
+1 -1
View File
@@ -42,7 +42,7 @@ def compress_whitespace(content):
def strip_trailing_lines(content):
end = None
while content[:end].endswith(b"\r\n"):
while content.endswith(b"\r\n", 0, end):
if end is None:
end = -2
else: