8000 imaplib: comment on benefit of reading in chunks · foresto/cpython@f650dfa · GitHub
[go: up one dir, main page]

Skip to content

Commit f650dfa

Browse files
committed
imaplib: comment on benefit of reading in chunks
Our read() implementation designed to support IDLE replaces the one from PR python#119514, fixing the same problem it was addressing. The tests that it added are preserved.
1 parent e8f0532 commit f650dfa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/imaplib.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ def read(self, size):
344344
# error condition instead of letting the caller decide how to handle a
345345
# timeout. We therefore implement our own buffered read().
346346
# https://github.com/python/cpython/issues/51571
347+
#
348+
# Reading in chunks instead of delegating to a single
349+
# BufferedReader.read() call also means we avoid its preallocation
350+
# of an unreasonably large memory block if a malicious server claims
351+
# it will send a huge literal without actually sending one.
352+
# https://github.com/python/cpython/issues/119511
347353

348354
parts = []
349355

0 commit comments

Comments
 (0)
0