From 37d4f7bc0c3b9c6e2bd858873c691c9d2bf091ae Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Sat, 23 Feb 2008 19:06:54 +0000 Subject: [PATCH] #1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh. --- Lib/imaplib.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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.