diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 08e15207a43..129de06b48e 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -1147,7 +1147,7 @@ class IMAP4_SSL(IMAP4): chunks = [] read = 0 while read < size: - data = self.sslobj.read(size-read) + data = self.sslobj.read(min(size-read, 16384)) read += len(data) chunks.append(data) diff --git a/Misc/NEWS b/Misc/NEWS index 4d40719e63a..0926e7f0090 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Core and builtins Library ------- +- Bug #1389051: imaplib causes excessive memory fragmentation when reading + large messages. + - Bug #1433694: minidom's .normalize() failed to set .nextSibling for last child element.