]> granicus.if.org Git - python/commitdiff
#20013: don't raise socket error when selected mailbox deleted.
authorR David Murray <rdmurray@bitdance.com>
Fri, 7 Feb 2014 18:47:40 +0000 (13:47 -0500)
committerR David Murray <rdmurray@bitdance.com>
Fri, 7 Feb 2014 18:47:40 +0000 (13:47 -0500)
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.

Lib/imaplib.py
Misc/NEWS

index 3f6656a7625af7e3eac8ff6ba4730f2b40774aba..ad5f4e9de84f85d51e66ee2c2f07b8bba36a6ddb 100644 (file)
@@ -1063,6 +1063,11 @@ class IMAP4:
                 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
index fb4a3680dc02912235d4ba66100eaf76d55e8232..bf7781ff397036cda40b6d8acb7cb983cfeb8696 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -45,6 +45,10 @@ Core and Builtins
 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.