gh-73613: Support Base32 and Base64 without padding#147974
gh-73613: Support Base32 and Base64 without padding#147974serhiy-storchaka merged 6 commits intopython:mainfrom
Conversation
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.
|
I noticed the https://github.com/python/cpython/actions/runs/23856718203/job/69552191340?pr=147974 failure, looking into it. |
There was a problem hiding this comment.
_B32_ENCODE_DOCSTRING and _B32_DECODE_DOCSTRING templates need updating.
There was a problem hiding this comment.
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>
|
Thank you @StanFromIreland. I thought it was a temporary issue which has already been fixed, because tests were passed after synchronizing with main. |
|
Thank you for your review @gpshead. |
| If *padded* is false, the '=' character is treated as other non-alphabet | ||
| characters (depending on the value of *validate* and *ignorechars*). |
There was a problem hiding this comment.
I can't make sense of this one and I'll have to read through the implementation to understand what it really means (i.e. what are the exact relations to validate and ignorechars).
Based on mayeut's comment in python#147974 (comment).
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/