summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-02-07 13:44:57 -0500
committerR David Murray <rdmurray@bitdance.com>2014-02-07 13:44:57 -0500
commit95ff7239bda51a234e04b1ad81c377fdf702faec (patch)
treee102c7c16c1c1a053fc85f6b9b97dafc0a95951c
parentfeb68522fd6e1d6ff3e096fdd1b4e57fd1cc09b0 (diff)
downloadcpython-git-95ff7239bda51a234e04b1ad81c377fdf702faec.tar.gz
#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.
-rw-r--r--Lib/imaplib.py5
-rw-r--r--Misc/NEWS4
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index ade2f9c2aa..ad104fe76a 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -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
diff --git a/Misc/NEWS b/Misc/NEWS
index b28079cd93..828cceb7a9 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,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 #20531: Revert 3.4 version of fix for #19063, and apply the 3.3
version. That is, do *not* raise an error if unicode is passed to
email.message.Message.set_payload.