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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user