Skip to content

gh-73613: Support Base32 and Base64 without padding#147974

Open
serhiy-storchaka wants to merge 5 commits intopython:mainfrom
serhiy-storchaka:base64-base32-padded
Open

gh-73613: Support Base32 and Base64 without padding#147974
serhiy-storchaka wants to merge 5 commits intopython:mainfrom
serhiy-storchaka:base64-base32-padded

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka commented Apr 1, 2026

Add the padded parameter in functions related to Base32 and Base64 codecs in the binascii and base64 modules. In the encoding functions it controls whether the pad character can be added in the output, in the decoding functions it controls whether padding is required in input.

Padding of input no longer required in base64.urlsafe_b64decode() by default.


📚 Documentation preview 📚: https://cpython-previews--147974.org.readthedocs.build/

Add the padded parameter in functions related to Base32 and Base64 codecs
in the binascii and base64 modules.  In the encoding functions it controls
whether the pad character can be added in the output, in the decoding
functions it controls whether padding is required in input.

Padding of input no longer required in base64.urlsafe_b64decode() by default.
@StanFromIreland
Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_B32_ENCODE_DOCSTRING and _B32_DECODE_DOCSTRING templates need updating.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I forgot to update docstrings!

I think it is better to get rid of _B32_ENCODE_DOCSTRING and _B32_DECODE_DOCSTRING templates and use normal docstrings. We already have a lot of near duplicates. But this is for a different issue.

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
@serhiy-storchaka
Copy link
Copy Markdown
Member Author

Thank you @StanFromIreland. I thought it was a temporary issue which has already been fixed, because tests were passed after synchronizing with main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants