[Email-SIG] fix email module for python 3000 (bytes/str)
victor.stinner at haypocalc.com
Sat Aug 11 01:49:10 CEST 2007
On Thursday 09 August 2007 02:41:08 Victor Stinner wrote:
> I started to work on email module to port it for Python 3000, but I have
> trouble to understand if a function should returns bytes or str (because I
> don't know email module).
It's really hard to convert email module to Python 3000 because it does mix
byte strings and (unicode) character strings...
I wrote some notes about bytes/str helping people to migrate Python 2.x code
to Python 3000, or at least to explain the difference between Python
2.x "str" type and Python 3000 "bytes" type:
About email module, some deductions:
test_email.py: openfile() must use 'rb' file mode for all tests
base64MIME.decode() and base64MIME.encode() should accept bytes and str
base64MIME.decode() result type is bytes
base64MIME.encode() result type should be... bytes or str, no idea
Other decode() and encode() functions should use same rules about types.
Python modules (binascii and base64) choosed bytes type for encode result.
Victor Stinner aka haypo
More information about the Email-SIG