[issue1210] imaplib does not run under Python 3

STINNER Victor report at bugs.python.org
Wed Oct 15 00:14:05 CEST 2008

STINNER Victor <victor.stinner at haypocalc.com> added the comment:

The server can send raw 8 bits email in any charset (charset is 
specified in the email headers). That's why I think that it's better 
to keep bytes instead of the unicode conversion using a fixed charset. 
Each email can use a different charset.

Types used in my new patch:
 - unicode:
   * IMAP commands (charset=ASCII)
   * untagged_responses keys (charset=ASCII)
 - bytes:
   * answer
   * regex
   * tagre attribute
   * untagged_responses values

I chooosed to keep unicode for some variables to minimize the changes 
in imaplib library and to keep readable code.

Patch TODO:
 - Remove the assert (added for quicker debugging)
 - Test more functions
 - Restore _checkquote() in _command() method or use 
_quote()/_checkquote() in method which need it. login() already quote 
the password (but why not the login?)

I also wrote a patch for a "pure bytes string" version, but the patch 
is complex, long and the resulting module source code is hard to read.

Added file: http://bugs.python.org/file11794/imaplib_bytes.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list