diff -r 9f9ae5f7c4ae Lib/imaplib.py --- a/Lib/imaplib.py Tue Dec 17 21:27:56 2013 -0500 +++ b/Lib/imaplib.py Wed Dec 18 10:29:06 2013 -0500 @@ -990,6 +990,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