Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dac4791

Browse files
committed
Forward port r86386 after it fixed the 3.1 buildbot issues
1 parent d79f3c8 commit dac4791

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/imaplib.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ def _append_untagged(self, typ, dat):
818818
def _check_bye(self):
819819
bye = self.untagged_responses.get('BYE')
820820
if bye:
821-
raise self.abort(bye[-1])
821+
raise self.abort(bye[-1].decode('ascii', 'replace'))
822822

823823

824824
def _command(self, name, *args):
@@ -899,14 +899,17 @@ def _command(self, name, *args):
899899

900900

901901
def _command_complete(self, name, tag):
902-
self._check_bye()
902+
# BYE is expected after LOGOUT
903+
if name != 'LOGOUT':
904+
self._check_bye()
903905
try:
904906
typ, data = self._get_tagged_response(tag)
905907
except self.abort as val:
906908
raise self.abort('command: %s => %s' % (name, val))
907909
except self.error as val:
908910
raise self.error('command: %s => %s' % (name, val))
909-
self._check_bye()
911+
if name != 'LOGOUT':
912+
self._check_bye()
910913
if typ == 'BAD':
911914
raise self.error('%s command error: %s %s' % (name, typ, data))
912915
return typ, data

0 commit comments

Comments
 (0)