oslo.serialization/oslo_serialization
Stephen Finucane ede68f08d3 Don't raise TypeError for invalid b64
In Python 2, the 'b64decode' function calls the 'binascii.a2b_base64'
function but catches any 'binascii.Error' exceptions raised and raises a
TypeError instead [1]. In Python 3, a 'binascii.Error' error is raised
instead [2]. Rather than forcing users to handle two types of exception,
we can allow them to catch only the 'bisascii.Error'. Python 2 provides
a function that does just this - 'decodestring' - which we can use. Make
it so.

[1] https://github.com/python/cpython/blob/2.7/Lib/base64.py#L78
[2] https://github.com/python/cpython/blob/3.5/Lib/base64.py#L87
[3] https://github.com/python/cpython/blob/2.7/Lib/base64.py#L326

Change-Id: I72c6de71b174181292427128d20e03756f85fb97
2016-12-14 16:16:41 +00:00
..
serializer Unified and simplified API for all serializers 2016-04-04 15:27:16 +03:00
tests Don't raise TypeError for invalid b64 2016-12-14 16:16:41 +00:00
__init__.py Move files out of the namespace package 2015-01-05 15:40:06 -05:00
base64.py Don't raise TypeError for invalid b64 2016-12-14 16:16:41 +00:00
jsonutils.py Fix serialization of binary strings in Python3 2016-08-01 16:58:08 +03:00
msgpackutils.py Replace TypeError by ValueError in msgpackutils 2016-06-08 08:41:36 +00:00