Commit 11e552f7 authored by Alexandre Vassalotti's avatar Alexandre Vassalotti

Make b64encode raises properly a TypeError when altchars is not bytes.

parent 4982735d
......@@ -58,8 +58,8 @@ def b64encode(s, altchars=None):
encoded = binascii.b2a_base64(s)[:-1]
if altchars is not None:
if not isinstance(altchars, bytes_types):
altchars = TypeError("expected bytes, not %s"
% altchars.__class__.__name__)
raise TypeError("expected bytes, not %s"
% altchars.__class__.__name__)
assert len(altchars) == 2, repr(altchars)
return _translate(encoded, {'+': altchars[0:1], '/': altchars[1:2]})
return encoded
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment