Author wiggin15
Recipients wiggin15
Date 2010-09-30.12:03:05
SpamBayes Score 9.4411e-09
Marked as misclassified No
Message-id <1285848203.41.0.985893389249.issue9996@psf.upfronthosting.co.za>
In-reply-to
Content
binascii is currently bytes-only, although the "a" in a2b\b2a should refer to unicode strings.
This patch fixes all a2b functions to take str type and all b2a functions to return str types.
This was discussed several times, for example:
http://www.gossamer-threads.com/lists/python/dev/863892
http://bugs.python.org/issue4770#msg78475
As discussed, the required behavior in Python 3k is that a2b should convert str to bytes and vice versa, and this was implemented in this patch.

This patch breaks backward compatibility in several functions... It also required fixing several files under Lib (although most cases were simplified), and also to change the interface of the base64 and quopri modules (this was also requested, e.g. http://bugs.python.org/issue4769).
Note that there already was a small change in this behavior from 3.1 to 3.2 (http://bugs.python.org/issue4770) - b2a_hex and b2a_qp COULD receive strings as input in 3.1 and this was changed in 3.2, so technically, compatibility was already broken...

The patch includes updates to the standard library, the tests and documentation.
rlecode and rledecode were left untouched because they are not a2b\b2a functions per se - they work on the input and output of the hqx functions (maybe it's a good idea to add new a2b\b2a functions for rle_hqx).

Any thoughts are welcome.
History
Date User Action Args
2010-09-30 12:03:28wiggin15setrecipients: + wiggin15
2010-09-30 12:03:23wiggin15setmessageid: <1285848203.41.0.985893389249.issue9996@psf.upfronthosting.co.za>
2010-09-30 12:03:18wiggin15linkissue9996 messages
2010-09-30 12:03:18wiggin15create