diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-10 00:02:28 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-10 00:02:28 (GMT) |
commit | e87875bfad3ebe18bf87ebd5cbe3db493c34dc1f (patch) | |
tree | a0836f900fb9cc2d7d1559e3ccc583fecc976c02 /Lib | |
parent | 5466e920d9f1df9d0ef5cae6b11ec7250fbbdd1e (diff) | |
download | cpython-e87875bfad3ebe18bf87ebd5cbe3db493c34dc1f.zip cpython-e87875bfad3ebe18bf87ebd5cbe3db493c34dc1f.tar.gz cpython-e87875bfad3ebe18bf87ebd5cbe3db493c34dc1f.tar.bz2 |
Try to fix test_imaplib failure
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/imaplib.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index e020747..94f4e8f 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -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,14 +899,17 @@ class IMAP4: def _command_complete(self, name, tag): - self._check_bye() + # BYE is expected after LOGOUT + if name != 'LOGOUT': + self._check_bye() try: typ, data = self._get_tagged_response(tag) except self.abort as val: raise self.abort('command: %s => %s' % (name, val)) except self.error as val: raise self.error('command: %s => %s' % (name, val)) - self._check_bye() + if name != 'LOGOUT': + self._check_bye() if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) return typ, data |