]> 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:51:22 +0000 (13:51 -0500)
committerR David Murray <rdmurray@bitdance.com>
Fri, 7 Feb 2014 18:51:22 +0000 (13:51 -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 4586fb39e2fe421ef2dd14042d95ad6567f3f6a0..10ff340ef96f5d8d2bd44f692ad1be1d90548a82 100644 (file)
@@ -1002,6 +1002,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 9520fa4963eb3f09b862c05ef9b49d60e616f9d7..9479ded78ae8019a312e7edd9b637ad6be0b786b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,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 #20426: When passing the re.DEBUG flag, re.compile() displays the
   debug output every time it is called, regardless of the compilation cache.