Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: added documentation
  • Loading branch information
moneebullah25 committed Jan 20, 2026
commit f8bba19b027354f9c43e05645564eb7d71900e83
11 changes: 10 additions & 1 deletion Doc/library/base64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ POST request.
Added the *wrapcol* parameter.


.. function:: b64decode(s, altchars=None, validate=False)
.. function:: b64decode(s, altchars=None, validate=False, *, ignorechars=None)

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

Optional *ignorechars* must be a :term:`bytes-like object` specifying
characters to ignore during decoding. When provided, only characters in
this set will be silently ignored; other non-base64 characters will cause
a :exc:`binascii.Error`. When ``None`` (the default), the behavior is
controlled by the *validate* parameter.

For more information about the strict base64 check, see :func:`binascii.a2b_base64`

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

.. versionchanged:: next
Added the *ignorechars* parameter.

.. function:: standard_b64encode(s)

Encode :term:`bytes-like object` *s* using the standard Base64 alphabet
Expand Down
11 changes: 10 additions & 1 deletion Doc/library/binascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The :mod:`binascii` module defines the following functions:
Added the *backtick* parameter.


.. function:: a2b_base64(string, /, *, strict_mode=False)
.. function:: a2b_base64(string, /, *, strict_mode=False, ignorechars=None)

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

Optional *ignorechars* must be a :term:`bytes-like object` specifying
characters to ignore during decoding. When provided, only characters in
this set will be silently ignored; other non-base64 characters will cause
an error. When ``None`` (the default), all non-base64 characters are
silently ignored (unless *strict_mode* is true).

.. versionchanged:: 3.11
Added the *strict_mode* parameter.

.. versionchanged:: next
Added the *ignorechars* parameter.


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

Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,19 @@ base64
* Added the *wrapcol* parameter in :func:`~base64.b64encode`.
(Contributed by Serhiy Storchaka in :gh:`143214`.)

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


binascii
--------

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

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


calendar
--------
Expand Down
Loading