mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Merged revisions 73656,73658,73663,73666 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r73656 | mark.dickinson | 2009-06-29 00:08:40 +0200 (Mo, 29 Jun 2009) | 1 line Fix description of range_length_obj ........ r73658 | raymond.hettinger | 2009-06-29 00:30:13 +0200 (Mo, 29 Jun 2009) | 1 line Small doc fix-ups to floatingpoint.rst. More are forthcoming. ........ r73663 | raymond.hettinger | 2009-06-29 01:21:38 +0200 (Mo, 29 Jun 2009) | 1 line Clean-up floating point tutorial. ........ r73666 | alexandre.vassalotti | 2009-06-29 03:13:41 +0200 (Mo, 29 Jun 2009) | 2 lines Make b64encode raises properly a TypeError when altchars is not bytes. ........
This commit is contained in:
parent
98e472d7fb
commit
7d1e88063c
3 changed files with 10 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue