Skip to content

Commit f8bba19

Browse files
committed
docs: added documentation
1 parent 5cfb7da commit f8bba19

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

Doc/library/base64.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ POST request.
7272
Added the *wrapcol* parameter.
7373

7474

75-
.. function:: b64decode(s, altchars=None, validate=False)
75+
.. function:: b64decode(s, altchars=None, validate=False, *, ignorechars=None)
7676

7777
Decode the Base64 encoded :term:`bytes-like object` or ASCII string
7878
*s* and return the decoded :class:`bytes`.
@@ -90,10 +90,19 @@ POST request.
9090
these non-alphabet characters in the input result in a
9191
:exc:`binascii.Error`.
9292

93+
Optional *ignorechars* must be a :term:`bytes-like object` specifying
94+
characters to ignore during decoding. When provided, only characters in
95+
this set will be silently ignored; other non-base64 characters will cause
96+
a :exc:`binascii.Error`. When ``None`` (the default), the behavior is
97+
controlled by the *validate* parameter.
98+
9399
For more information about the strict base64 check, see :func:`binascii.a2b_base64`
94100

95101
May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2.
96102

103+
.. versionchanged:: next
104+
Added the *ignorechars* parameter.
105+
97106
.. function:: standard_b64encode(s)
98107

99108
Encode :term:`bytes-like object` *s* using the standard Base64 alphabet

Doc/library/binascii.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The :mod:`binascii` module defines the following functions:
4848
Added the *backtick* parameter.
4949

5050

51-
.. function:: a2b_base64(string, /, *, strict_mode=False)
51+
.. function:: a2b_base64(string, /, *, strict_mode=False, ignorechars=None)
5252

5353
Convert a block of base64 data back to binary and return the binary data. More
5454
than one line may be passed at a time.
@@ -63,9 +63,18 @@ The :mod:`binascii` module defines the following functions:
6363
* Contains no excess data after padding (including excess padding, newlines, etc.).
6464
* Does not start with a padding.
6565

66+
Optional *ignorechars* must be a :term:`bytes-like object` specifying
67+
characters to ignore during decoding. When provided, only characters in
68+
this set will be silently ignored; other non-base64 characters will cause
69+
an error. When ``None`` (the default), all non-base64 characters are
70+
silently ignored (unless *strict_mode* is true).
71+
6672
.. versionchanged:: 3.11
6773
Added the *strict_mode* parameter.
6874

75+
.. versionchanged:: next
76+
Added the *ignorechars* parameter.
77+
6978

7079
.. function:: b2a_base64(data, *, wrapcol=0, newline=True)
7180

Doc/whatsnew/3.15.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,19 @@ base64
444444
* Added the *wrapcol* parameter in :func:`~base64.b64encode`.
445445
(Contributed by Serhiy Storchaka in :gh:`143214`.)
446446

447+
* Added the *ignorechars* parameter in :func:`~base64.b64decode`.
448+
(Contributed by Muneeb Ullah in :gh:`144001`.)
449+
447450

448451
binascii
449452
--------
450453

451454
* Added the *wrapcol* parameter in :func:`~binascii.b2a_base64`.
452455
(Contributed by Serhiy Storchaka in :gh:`143214`.)
453456

457+
* Added the *ignorechars* parameter in :func:`~binascii.a2b_base64`.
458+
(Contributed by Muneeb Ullah in :gh:`144001`.)
459+
454460

455461
calendar
456462
--------

0 commit comments

Comments
 (0)