@@ -53,21 +53,23 @@ The modern interface provides:
5353 Encode the :term: `bytes-like object ` *s * using Base64 and return the encoded
5454 :class: `bytes `.
5555
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 `.
6163
6264
6365.. function :: b64decode(s, altchars=None, validate=False)
6466
6567 Decode the Base64 encoded :term: `bytes-like object ` or ASCII string
6668 *s * and return the decoded :class: `bytes `.
6769
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.
7173
7274 A :exc: `binascii.Error ` exception is raised
7375 if *s * is incorrectly padded.
@@ -78,6 +80,7 @@ The modern interface provides:
7880 these non-alphabet characters in the input result in a
7981 :exc: `binascii.Error `.
8082
83+ May assert or raise a :exc: `ValueError ` if the length of *altchars * is not 2.
8184
8285.. function :: standard_b64encode(s)
8386
0 commit comments