From 9a277cfd022ca0aaf0513ca407c05225f5fdc049 Mon Sep 17 00:00:00 2001 From: Vincent Beffara Date: Tue, 22 Mar 2011 15:51:42 +0100 Subject: [PATCH] Remove a darwin-specific workaround for read() Because of a buggy realloc() implementation in earlier versions of Python on Mac OS X, we had to cut reads into manageable chunks by hand; this is no more needed with Python 2.6, and besides it causes problems with imaplib2, which we now use. Revert the special case to use the system's read() instead, which is now safe. Signed-off-by: Vincent Beffara Reviewed-by: Sebastian Spaeth Signed-off-by: Nicolas Sebrecht --- offlineimap/imapserver.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index f05c743..fc7a503 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -65,24 +65,7 @@ class UsefulIMAPMixIn: def _mesg(self, s, tn=None, secs=None): imaplibutil.new_mesg(self, s, tn, secs) -class UsefulIMAP4(UsefulIMAPMixIn, imaplibutil.WrappedIMAP4): - # This is a hack around Darwin's implementation of realloc() (which - # Python uses inside the socket code). On Darwin, we split the - # message into small chunks. - # see http://bugs.python.org/issue3531 - def read(self, size): - if (system() == 'Darwin') and (size>0) : - read = 0 - io = StringIO() - while read < size: - data = imaplib.IMAP4.read (self, min(size-read, 65536)) - if not data: - break - read += len(data) - io.write(data) - return io.getvalue() - else: - return imaplib.IMAP4.read (self, size) +class UsefulIMAP4(UsefulIMAPMixIn, imaplibutil.WrappedIMAP4): pass class UsefulIMAP4_SSL(UsefulIMAPMixIn, imaplibutil.WrappedIMAP4_SSL): pass