Skip to content

Commit

Permalink
imaplib: comment on benefit of reading in chunks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
foresto committed Feb 4, 2025
1 parent e8f0532 commit f650dfa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ def read(self, size):
# error condition instead of letting the caller decide how to handle a
# timeout. We therefore implement our own buffered read().
# https://github.com/python/cpython/issues/51571
#
# Reading in chunks instead of delegating to a single
# BufferedReader.read() call also means we avoid its preallocation
# of an unreasonably large memory block if a malicious server claims
# it will send a huge literal without actually sending one.
# https://github.com/python/cpython/issues/119511

parts = []

Expand Down

0 comments on commit f650dfa

Please sign in to comment.