diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-03-19 17:52:33 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-03-19 17:52:33 (GMT) |
commit | fcb6d6a3b3bfba67927ced18dd648ba889e14f4c (patch) | |
tree | 2fd07ed3bc58201cfb53ad8046c83a80bdec4bd4 /Lib/imaplib.py | |
parent | ae4ef4d2ff2d49628516294837249493f43a5047 (diff) | |
download | cpython-fcb6d6a3b3bfba67927ced18dd648ba889e14f4c.zip cpython-fcb6d6a3b3bfba67927ced18dd648ba889e14f4c.tar.gz cpython-fcb6d6a3b3bfba67927ced18dd648ba889e14f4c.tar.bz2 |
#17443: Fix buffering in IMAP4_stream.
In Python2 Popen uses *FILE objects, which wind up buffering even though
subprocess defaults to no buffering. In Python3, subprocess streams really
are unbuffered by default, but the imaplib code assumes read is buffered. This
patch uses the default buffer size from the io module to get buffered streams
from Popen.
Much debugging work and patch by Diane Trout.
The imap protocol is too complicated to write a test for this simple
change with our current level of test infrastructure.
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r-- | Lib/imaplib.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 00a17fb..e2a0581 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -23,6 +23,7 @@ Public functions: Internaldate2tuple __version__ = "2.58" import binascii, errno, random, re, socket, subprocess, sys, time, calendar +from io import DEFAULT_BUFFER_SIZE try: import ssl @@ -1237,6 +1238,7 @@ class IMAP4_stream(IMAP4): self.sock = None self.file = None self.process = subprocess.Popen(self.command, + bufsize=DEFAULT_BUFFER_SIZE, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin |