@@ -73,6 +73,7 @@ POST request.
7373
7474
7575.. function :: b64decode(s, altchars=None, validate=False)
76+ b64decode(s, altchars=None, validate=True, *, ignorechars)
7677
7778 Decode the Base64 encoded :term: `bytes-like object ` or ASCII string
7879 *s * and return the decoded :class: `bytes `.
@@ -84,15 +85,30 @@ POST request.
8485 A :exc: `binascii.Error ` exception is raised
8586 if *s * is incorrectly padded.
8687
87- If *validate * is ``False `` (the default), characters that are neither
88+ If *ignorechars * is specified, it should be a :term: `bytes-like object `
89+ containing characters to ignore from the input when *validate * is true.
90+ The default value of *validate * is ``True `` if *ignorechars * is specified,
91+ ``False `` otherwise.
92+
93+ If *validate * is false, characters that are neither
8894 in the normal base-64 alphabet nor the alternative alphabet are
89- discarded prior to the padding check. If *validate * is ``True ``,
90- these non-alphabet characters in the input result in a
91- :exc: `binascii.Error `.
95+ discarded prior to the padding check, but the ``+ `` and ``/ `` characters
96+ keep their meaning if they are not in *altchars * (they will be discarded
97+ in future Python versions).
98+
99+ If *validate * is true, these non-alphabet characters in the input
100+ result in a :exc: `binascii.Error `.
92101
93102 For more information about the strict base64 check, see :func: `binascii.a2b_base64 `
94103
95- May assert or raise a :exc: `ValueError ` if the length of *altchars * is not 2.
104+ .. deprecated :: next
105+ Accepting the ``+ `` and ``/ `` characters with an alternative alphabet
106+ is now deprecated.
107+
108+
109+ .. versionchanged :: next
110+ Added the *ignorechars * parameter.
111+
96112
97113.. function :: standard_b64encode(s)
98114
@@ -123,6 +139,9 @@ POST request.
123139 ``/ `` in the standard Base64 alphabet, and return the decoded
124140 :class: `bytes `.
125141
142+ .. deprecated :: next
143+ Accepting the ``+ `` and ``/ `` characters is now deprecated.
144+
126145
127146.. function :: b32encode(s)
128147
@@ -246,8 +265,7 @@ Refer to the documentation of the individual functions for more information.
246265 *adobe * controls whether the input sequence is in Adobe Ascii85 format
247266 (i.e. is framed with <~ and ~>).
248267
249- *ignorechars * should be a :term: `bytes-like object ` or ASCII string
250- containing characters to ignore
268+ *ignorechars * should be a byte string containing characters to ignore
251269 from the input. This should only contain whitespace characters, and by
252270 default contains all whitespace characters in ASCII.
253271
0 commit comments