summaryrefslogtreecommitdiff
path: root/Lib/base64.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2009-06-29 01:13:41 +0000
committerAlexandre Vassalotti <alexandre@peadrop.com>2009-06-29 01:13:41 +0000
commit5629268e9db5690c6bfbc6845ce7bf7bc6e65637 (patch)
tree84b3752dc66838721ca05f10316c99b7902af067 /Lib/base64.py
parent70f52768fd1070b457d674bed368c69cb4a7483c (diff)
downloadcpython-git-5629268e9db5690c6bfbc6845ce7bf7bc6e65637.tar.gz
Make b64encode raises properly a TypeError when altchars is not bytes.
Diffstat (limited to 'Lib/base64.py')
-rwxr-xr-xLib/base64.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/base64.py b/Lib/base64.py
index 73e980813d..e708136469 100755
--- a/Lib/base64.py
+++ b/Lib/base64.py
@@ -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