@@ -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,11 +85,17 @@ 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
8995 discarded prior to the padding check, but the ``+ `` and ``/ `` characters
9096 keep their meaning if they are not in *altchars * (they will be discarded
9197 in future Python versions).
98+
9299 If *validate * is true, these non-alphabet characters in the input
93100 result in a :exc: `binascii.Error `.
94101
@@ -99,6 +106,10 @@ POST request.
99106 is now deprecated.
100107
101108
109+ .. versionchanged :: next
110+ Added the *ignorechars * parameter.
111+
112+
102113.. function :: standard_b64encode(s)
103114
104115 Encode :term: `bytes-like object ` *s * using the standard Base64 alphabet
@@ -254,8 +265,7 @@ Refer to the documentation of the individual functions for more information.
254265 *adobe * controls whether the input sequence is in Adobe Ascii85 format
255266 (i.e. is framed with <~ and ~>).
256267
257- *ignorechars * should be a :term: `bytes-like object ` or ASCII string
258- containing characters to ignore
268+ *ignorechars * should be a byte string containing characters to ignore
259269 from the input. This should only contain whitespace characters, and by
260270 default contains all whitespace characters in ASCII.
261271
0 commit comments