-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-35557 - Allow base64.b16decode() to accept lowercase hexadecimal characters by default #11285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-35557 - Allow base64.b16decode() to accept lowercase hexadecimal characters by default #11285
Conversation
…ase characters by default, and eliminate the consequently unnecessary second argument casefold
…ment to base64.b16decode() (casefold) and the function accepts hexadecimal strings with lowercase characters by default
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
With regards to the CLA - I've only just signed it 15 minutes ago or so, so that's likely why the check is failing :) |
Since the `casefold` argument is removed, alter the docstring to reflect that and get rid of the reference to a second argument
Assuming the change isn't met with resistance from a security perspective, there is probably no need to keep a stale RFC reference around that mentions an outdated security consideration
@DJHoulihan Please complete the title of the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch @DJHoulihan!
Changes LGTM, but it still need more work to be accepted:
- Add a NEWs entry (you can use https://blurb-it.herokuapp.com)
- Update the documentation
And even more, why not updating other functions to remove completely the casefold
argument?
(I requested changes only, the labels update is wrong as there still need work) |
And I just read the BPO. The patch will unlikely be merged as it breaks the compatibility with old Python versions. |
Hello,
This pull request addresses the proposed changes in issue 35557. Namely, it refactors
base64.b16decode()
to accept both lowercase and uppercase hexadecimal strings without requiring the use of thecasefold
parameter. The motivating reasons for this change are outlined in the corresponding issue.Specifically, the code changes to the two files are as follows:
Expand the regular expression matching string from
0-9A-F
to0-9A-Fa-f
;Remove the
casefold
argument, its default value, and the conditional check for its value within the method;Remove the tests under
test_base64.py
which check thecasefold
conditional checking behavior (and only those tests!).This change passes all other tests for
base64.py
. I also attached a file on the corresponding issue which demonstrates a ~9.4% performance improvement on decoding hexadecimal strings due to the removal of thecasefold
parameter.https://bugs.python.org/issue35557