From: Charles-François Natali Date: Tue, 24 May 2011 21:47:49 +0000 (+0200) Subject: Issue #1441530: In imaplib, read the data in one chunk to speed up large X-Git-Tag: v3.3.0a1~2183^2~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f4560c872f56e0d416dd091e9dbccbb93f716ba;p=python Issue #1441530: In imaplib, read the data in one chunk to speed up large reads and simplify code. --- diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 142e27bc87..1b540655f2 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -249,15 +249,7 @@ class IMAP4: def read(self, size): """Read 'size' bytes from remote.""" - chunks = [] - read = 0 - while read < size: - data = self.file.read(min(size-read, 4096)) - if not data: - break - read += len(data) - chunks.append(data) - return b''.join(chunks) + return self.file.read(size) def readline(self): diff --git a/Misc/NEWS b/Misc/NEWS index 917dfe3ab3..68130a92ee 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -161,6 +161,9 @@ Core and Builtins Library ------- +- Issue #1441530: In imaplib, read the data in one chunk to speed up large + reads and simplify code. + - Issue #12070: Fix the Makefile parser of the sysconfig module to handle correctly references to "bogus variable" (e.g. "prefix=$/opt/python").