bug when using offlineimap with python v2.7.2rc1

Scott Moser smoser at ubuntu.com
Fri Jun 3 17:41:09 BST 2011

Hi all,
   I'm using Ubuntu Oneiric (development branch), and this week brought
python version 2.7.2rc1 into the archive.
   That broke offlineimap with SSL for me.  I've opened bug 792043 [1],
and then done some debugging.  The breakage is caused by a change that
went into python imaplib for python issue 1441530 [2].  You can see the
specific patch that caused the problem at [3].

   Locally, I've tested the fix below.  It seems to work both with
python2.6 and python2.7.

[1] http://pad.lv/792043
[2] http://bugs.python.org/issue1441530
[3] http://bugs.python.org/file22063/imaplib_recv_27.diff

diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py
index a60242b..21ee3d2 100644
--- a/offlineimap/imaplibutil.py
+++ b/offlineimap/imaplibutil.py
@@ -172,6 +172,7 @@ def new_open_ssl(self, host = '', port = IMAP4_SSL_PORT):
             # FIXME
             raise socket.error(last_error)
         self.sslobj = ssl_wrap(self.sock, self.keyfile, self.certfile)
+        self.file = self.sslobj.makefile('rb')
         self.sslobj = sslwrapper(self.sslobj)

 mustquote = re.compile(r"[^\w!#$%&'+,.:;<=>?^`|~-]")

More information about the OfflineIMAP-project mailing list