[Python-checkins] cpython (3.2): #17443: Fix buffering in IMAP4_stream.
r.david.murray
python-checkins at python.org
Tue Mar 19 18:57:52 CET 2013
http://hg.python.org/cpython/rev/c5aacf9d1cdc
changeset: 82761:c5aacf9d1cdc
branch: 3.2
parent: 82758:02e028b104d3
user: R David Murray <rdmurray at bitdance.com>
date: Tue Mar 19 13:52:33 2013 -0400
summary:
#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.
files:
Lib/imaplib.py | 2 ++
Misc/ACKS | 1 +
Misc/NEWS | 4 ++++
3 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -23,6 +23,7 @@
__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 @@
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
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1098,6 +1098,7 @@
Nathan Trapuzzano
Laurence Tratt
John Tromp
+Diane Trout
Jason Trowbridge
Brent Tubbs
Anthony Tuininga
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -233,6 +233,10 @@
Library
-------
+- Issue #17443: impalib.IMAP4_stream was using the default unbuffered IO
+ in subprocess, but the imap code assumes buffered IO. In Python2 this
+ worked by accident. IMAP4_stream now explicitly uses buffered IO.
+
- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc
'allmethods'; it was missing unbound methods on the class.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list