Skip to content

Commit 5629268

Browse files
committed
Make b64encode raises properly a TypeError when altchars is not bytes.
1 parent 70f5276 commit 5629268

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/base64.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def b64encode(s, altchars=None):
5858
encoded = binascii.b2a_base64(s)[:-1]
5959
if altchars is not None:
6060
if not isinstance(altchars, bytes_types):
61-
altchars = TypeError("expected bytes, not %s"
62-
% altchars.__class__.__name__)
61+
raise TypeError("expected bytes, not %s"
62+
% altchars.__class__.__name__)
6363
assert len(altchars) == 2, repr(altchars)
6464
return _translate(encoded, {'+': altchars[0:1], '/': altchars[1:2]})
6565
return encoded

0 commit comments

Comments
 (0)