Skip to content

Commit 95ff723

Browse files
committed
python#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.
1 parent feb6852 commit 95ff723

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Lib/imaplib.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,11 @@ def _get_tagged_response(self, tag):
10631063
del self.tagged_commands[tag]
10641064
return result
10651065

1066+
# If we've seen a BYE at this point, the socket will be
1067+
# closed, so report the BYE now.
1068+
1069+
self._check_bye()
1070+
10661071
# Some have reported "unexpected response" exceptions.
10671072
# Note that ignoring them here causes loops.
10681073
# Instead, send me details of the unexpected response and

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ Core and Builtins
2424
Library
2525
-------
2626

27+
- Issue #20013: Some imap servers disconnect if the current mailbox is
28+
deleted, and imaplib did not handle that case gracefully. Now it
29+
handles the 'bye' correctly.
30+
2731
- Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3
2832
version. That is, do *not* raise an error if unicode is passed to
2933
email.message.Message.set_payload.

0 commit comments

Comments
 (0)