]> granicus.if.org Git - python/commitdiff
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik...
authorAndrew M. Kuchling <amk@amk.ca>
Sat, 23 Feb 2008 19:06:54 +0000 (19:06 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Sat, 23 Feb 2008 19:06:54 +0000 (19:06 +0000)
Lib/imaplib.py
Misc/NEWS

index 08e15207a43df089a78eeb5c507128ce1670d36d..129de06b48e338be1d4c0b5a7d0bfc5645f121ba 100644 (file)
@@ -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)
 
index 4d40719e63af965a9b7a1bc939b08c029a88c09a..0926e7f00907f76330627e173fb69c0518619afa 100644 (file)
--- 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.