Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f4560c

Browse files
author
Charles-François Natali
committed
Issue #1441530: In imaplib, read the data in one chunk to speed up large
reads and simplify code.
1 parent 17dc819 commit 1f4560c

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

Lib/imaplib.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,7 @@ def open(self, host = '', port = IMAP4_PORT):
249249

250250
def read(self, size):
251251
"""Read 'size' bytes from remote."""
252-
chunks = []
253-
read = 0
254-
while read < size:
255-
data = self.file.read(min(size-read, 4096))
256-
if not data:
257-
break
258-
read += len(data)
259-
chunks.append(data)
260-
return b''.join(chunks)
252+
return self.file.read(size)
261253

262254

263255
def readline(self):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ Core and Builtins
161161
Library
162162
-------
163163

164+
- Issue #1441530: In imaplib, read the data in one chunk to speed up large
165+
reads and simplify code.
166+
164167
- Issue #12070: Fix the Makefile parser of the sysconfig module to handle
165168
correctly references to "bogus variable" (e.g. "prefix=$/opt/python").
166169

0 commit comments

Comments
 (0)