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 142e27b..1b54065 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -249,15 +249,7 @@
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):