Skip to content

Expose C constant HASHLIB_GIL_MINSIZE #132993

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

Closed
picnixz opened this issue Apr 26, 2025 · 1 comment
Closed

Expose C constant HASHLIB_GIL_MINSIZE #132993

picnixz opened this issue Apr 26, 2025 · 1 comment
Assignees
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@picnixz
Copy link
Member

picnixz commented Apr 26, 2025

Feature or enhancement

Proposal:

In hashlib.h, we have a HASHLIB_GIL_MINSIZE constant that we could expose as hashlib.GIL_MINSIZE. For now it's a read-only constant since the constant is shared across multiple modules (_hashlib and HACL*-based primitives).

Since _hashlib may be missing but _md5 may not, it's better to place that constant in all modules. However, for it to be read-only, we should make it available in all modules it is shared by. That way, we can always have access to it for desired module and we can also change its per-module behavior in the future.

Note: this is typically useful in tests where for now it's always hardcoded.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@picnixz picnixz added extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Apr 26, 2025
@picnixz picnixz self-assigned this Apr 26, 2025
@picnixz picnixz changed the title Expose C constant HASHLIB_GIL_MINSIZE as hashlib.GIL_MINSIZE Expose C constant HASHLIB_GIL_MINSIZE Apr 26, 2025
@picnixz
Copy link
Member Author

picnixz commented Apr 27, 2025

Note to myself: if we make it per-module, don't forget to update the docs (https://docs.python.org/3/library/hashlib.html#hash-algorithms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant