@@ -53,21 +53,23 @@ The modern interface provides:
53
53
Encode the :term: `bytes-like object ` *s * using Base64 and return the encoded
54
54
:class: `bytes `.
55
55
56
- Optional *altchars * must be a :term: `bytes-like object ` of at least
57
- length 2 (additional characters are ignored) which specifies an alternative
58
- alphabet for the ``+ `` and ``/ `` characters. This allows an application to e.g.
59
- generate URL or filesystem safe Base64 strings. The default is ``None ``, for
60
- which the standard Base64 alphabet is used.
56
+ Optional *altchars * must be a :term: `bytes-like object ` of length 2 which
57
+ specifies an alternative alphabet for the ``+ `` and ``/ `` characters.
58
+ This allows an application to e.g. generate URL or filesystem safe Base64
59
+ strings. The default is ``None ``, for which the standard Base64 alphabet is used.
60
+
61
+ May assert or raise a a :exc: `ValueError ` if the length of *altchars * is not 2. Raises a
62
+ :exc: `TypeError ` if *altchars * is not a :term: `bytes-like object `.
61
63
62
64
63
65
.. function :: b64decode(s, altchars=None, validate=False)
64
66
65
67
Decode the Base64 encoded :term: `bytes-like object ` or ASCII string
66
68
*s * and return the decoded :class: `bytes `.
67
69
68
- Optional *altchars * must be a :term: `bytes-like object ` or ASCII string of
69
- at least length 2 (additional characters are ignored) which specifies the
70
- alternative alphabet used instead of the ``+ `` and ``/ `` characters.
70
+ Optional *altchars * must be a :term: `bytes-like object ` or ASCII string
71
+ of length 2 which specifies the alternative alphabet used instead of the
72
+ ``+ `` and ``/ `` characters.
71
73
72
74
A :exc: `binascii.Error ` exception is raised
73
75
if *s * is incorrectly padded.
@@ -80,6 +82,7 @@ The modern interface provides:
80
82
81
83
For more
5A09
information about the strict base64 check, see :func: `binascii.a2b_base64 `
82
84
85
+ May assert or raise a :exc: `ValueError ` if the length of *altchars * is not 2.
83
86
84
87
.. function :: standard_b64encode(s)
85
88
0 commit comments