[Python-checkins] cpython (3.3): #20013: don't raise socket error when selected mailbox deleted.

r.david.murray python-checkins at python.org
Fri Feb 7 19:51:55 CET 2014


http://hg.python.org/cpython/rev/aecc0a4be052
changeset:   89022:aecc0a4be052
branch:      3.3
parent:      89017:4daf3cec9419
user:        R David Murray <rdmurray at bitdance.com>
date:        Fri Feb 07 13:47:40 2014 -0500
summary:
  #20013: don't raise socket error when selected mailbox deleted.

I'm checking this in without a test because not much of this code
is tested and I don't have time to work up the necessary extensions
to the existing test framework.

The patch itself was tested by the person who reported the bug.

files:
  Lib/imaplib.py |  5 +++++
  Misc/NEWS      |  4 ++++
  2 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/Lib/imaplib.py b/Lib/imaplib.py
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -1063,6 +1063,11 @@
                 del self.tagged_commands[tag]
                 return result
 
+            # If we've seen a BYE at this point, the socket will be
+            # closed, so report the BYE now.
+
+            self._check_bye()
+
             # Some have reported "unexpected response" exceptions.
             # Note that ignoring them here causes loops.
             # Instead, send me details of the unexpected response and
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -45,6 +45,10 @@
 Library
 -------
 
+- Issue #20013: Some imap servers disconnect if the current mailbox is
+  deleted, and imaplib did not handle that case gracefully.  Now it
+  handles the 'bye' correctly.
+
 - Issue #19920: TarFile.list() no longer fails when outputs a listing
   containing non-encodable characters.  Based on patch by Vajrasky Kok.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list