Repository navigation
gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures - #134713
Conversation
…ementation-clinic-134696
|
While I doubt much code uses the keyword argument name on these, the non-breaking way to make this change is to accept both names and raise an error if both are supplied as well as a deprecation warning in 3.15 onwards when the undesired 'string=' one is supplied. |
commented
May 26, 2025
I actually had a helper function for |
|
@gpshead With these modifications, we should have full backwards compatibility |
commented
May 27, 2025
|
I'll be away for a few days (like every week) but I want to merge this one myself. |
|
I found a better way to do it offline so let's forget about this complicated stuff |
commented
May 30, 2025
|
In a follow-up PR, I'll keep [data] and deprecate 'string'. I don't think I'll make it positional-only. |
left a comment
There was a problem hiding this comment.
Agreed, I think this is a practical solution to this today.
We do have some deprecation warning support in AC already -https://devguide.python.org/development-tools/clinic/#how-to-deprecate-passing-parameters-positionally-or-by-keyword
which you could use for the string= kwarg as is in this PR if I understand the above doc correctly.
#108271 is the AC feature that'd probably have made this a bit easier.
commented
May 31, 2025
|
Since NULL indicates that the argument was not passed, we can easy do deprecation in the helper function. Argument Clinic support is needed to rename or remove parameters of the type that has no invalid value (e.g. |
commented
May 31, 2025
|
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
commented
May 31, 2025
|
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
commented
May 31, 2025
|
Sorry, @picnixz, I could not cleanly backport this to |
commented
May 31, 2025
|
Sorry, @picnixz, I could not cleanly backport this to |
commented
May 31, 2025
|
GH-134961 is a backport of this pull request to the 3.14 branch. |
commented
May 31, 2025
|
GH-134962 is a backport of this pull request to the 3.13 branch. |
commented
May 31, 2025
|
commented
May 31, 2025
|
Well. Of course. This build bot. |
This is a breaking change but this breaking change is needed. Because this is a really bad breaking change if we were to use Python 3.13 in production, I will not backport it to 3.13.I made the choice of following what is documented rather than what was historically done: https://docs.python.org/3/library/hashlib.html#hashlib.md5.
Historically, we could write
hashlib.md5(string=b'abc')(and this would be the only way to use a keyword argument here for the message to hash), but since the docs mention[data]as a regular argument (not positional-only), we should follow them. Also, I would like to make them positional-only in 3.17 (with a warning in 3.15).I will however backport this to 3.14 because it's time we make the hashlib API more consistent.