[Python-checkins] r86388 - python/branches/py3k/Lib/imaplib.py

antoine.pitrou python-checkins at python.org
Wed Nov 10 01:18:40 CET 2010


Author: antoine.pitrou
Date: Wed Nov 10 01:18:40 2010
New Revision: 86388

Log:
Forward port r86386 after it fixed the 3.1 buildbot issues



Modified:
   python/branches/py3k/Lib/imaplib.py

Modified: python/branches/py3k/Lib/imaplib.py
==============================================================================
--- python/branches/py3k/Lib/imaplib.py	(original)
+++ python/branches/py3k/Lib/imaplib.py	Wed Nov 10 01:18:40 2010
@@ -818,7 +818,7 @@
     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 @@
 
 
     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


More information about the Python-checkins mailing list