[New-bugs-announce] [issue13637] binascii.a2b_* functions could accept unicode strings

Antoine Pitrou report at bugs.python.org
Mon Dec 19 17:30:44 CET 2011


New submission from Antoine Pitrou <pitrou at free.fr>:

a2b_hex and friends accept only byte strings:

>>> binascii.a2b_hex(b'00')
b'\x00'
>>> binascii.a2b_hex('00')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface

But they could just as well accept ASCII-only unicode strings. Also, with PEP 393, accessing the 8-bit ASCII data doesn't even need a conversion.

----------
components: Library (Lib)
messages: 149876
nosy: haypo, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: binascii.a2b_* functions could accept unicode strings
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13637>
_______________________________________


More information about the New-bugs-announce mailing list