Forward port r86386 after it fixed the 3.1 buildbot issues

This commit is contained in:
Antoine Pitrou 2010-11-10 00:18:40 +00:00
parent d79f3c8b3a
commit dac47914d7
1 changed files with 6 additions and 3 deletions

View File

@ -818,7 +818,7 @@ class IMAP4:
def _check_bye(self):
bye = self.untagged_responses.get('BYE')
if bye:
raise self.abort(bye[-1])
raise self.abort(bye[-1].decode('ascii', 'replace'))
def _command(self, name, *args):
@ -899,6 +899,8 @@ class IMAP4:
def _command_complete(self, name, tag):
# BYE is expected after LOGOUT
if name != 'LOGOUT':
self._check_bye()
try:
typ, data = self._get_tagged_response(tag)
@ -906,6 +908,7 @@ class IMAP4:
raise self.abort('command: %s => %s' % (name, val))
except self.error as val:
raise self.error('command: %s => %s' % (name, val))
if name != 'LOGOUT':
self._check_bye()
if typ == 'BAD':
raise self.error('%s command error: %s %s' % (name, typ, data))