New submission from Arnon Yaari <wiggi...@gmail.com>:

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.

----------
components: Interpreter Core
files: binascii.diff
keywords: patch
messages: 117727
nosy: wiggin15
priority: normal
severity: normal
status: open
title: binascii should convert unicode strings
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19067/binascii.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9996>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to