diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-03-19 17:56:01 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-03-19 17:56:01 (GMT) |
commit | 7889944b83cf04cefb45cd658644298218eac5db (patch) | |
tree | fc1f6d1ff2f4ddc45d5726b3d3212b33a46510c0 /Lib | |
parent | e185341bfa177932b00a03a1d8b1d0e0e7795919 (diff) | |
parent | fcb6d6a3b3bfba67927ced18dd648ba889e14f4c (diff) | |
download | cpython-7889944b83cf04cefb45cd658644298218eac5db.zip cpython-7889944b83cf04cefb45cd658644298218eac5db.tar.gz cpython-7889944b83cf04cefb45cd658644298218eac5db.tar.bz2 |
Merge: #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')
-rw-r--r-- | Lib/imaplib.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index f8c7ffd..724f9d1 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -24,6 +24,8 @@ __version__ = "2.58" import binascii, errno, random, re, socket, subprocess, sys, time, calendar from datetime import datetime, timezone, timedelta +from io import DEFAULT_BUFFER_SIZE + try: import ssl HAVE_SSL = True @@ -1244,6 +1246,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 |