[docs] [issue27124] binascii.a2b_hex raises binascii.Error and ValueError, not TypeError

Martin Panter report at bugs.python.org
Thu May 26 05:03:13 EDT 2016


Martin Panter added the comment:

The TypeError → binascii.Error changeover was made in revision eb45f85c4c79, to this function, along with various decoding functions in the base64 module. The base64 documenation was only slowly updated in a series of bug fixes, and it looks like unhexlify() is the only one left.

At the top of the binascii documentation, it says that the decoding functions accept ASCII strings. The general check for non-ASCII code points (raising ValueError) would be done before the specific checks for hexadecimal digits and having the right length.

Luiz’s patch looks okay to me.

----------
nosy: +martin.panter
stage:  -> patch review
versions: +Python 3.5, Python 3.6 -Python 3.4

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


More information about the docs mailing list