-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Consider restoring _PyHASH_INF/BITS/MODULUS/IMAG as public #111389
Comments
CC @vstinner |
Python 3.12 has 5 constants implemented as macros:
Significant commits related to these constants:
Right, it makes sense to make them public. I'm not sure why it was private before. We can keep them as macros, but maybe we should consider declaring them as variables (using with |
I created capi-workgroup/api-evolution#37 to discuss that. |
…public This partially reverts python#107026.
Should we also add some functions like Py_HashPointer()? |
If constants are made public, yes, they must be documented. I don't think that PyUnstable prefix is needed, these constants seem stable. |
Maybe others (I don't know examples), but not this function. It's used currently in the gmpy2, but this could be replaced by cpython/Doc/library/stdtypes.rst Lines 789 to 790 in 63acf78
Ok, I'll go with suggested above
Yep. But can be removed in any minor release, as |
https://docs.python.org/dev/library/sys.html is the Python API. For the C API, I would prefer to create a new page under https://docs.python.org/dev/c-api/ category. |
UPD: The one drawback with the On one hand, this is unlikely to be changed. On another hand, this situation is not documented. Maybe it should? |
I restored _PyHASH constants with PR #112115. |
I proposed PR #112096 to add Py_HashPointer() function. |
@skirpichev: Once a public |
) Co-authored-by: Victor Stinner <[email protected]>
You can now propose changes for these projects to use the public names :-) I added the constants to pythoncapi-compat: python/pythoncapi-compat@7539c7f |
…python#111418) Co-authored-by: Victor Stinner <[email protected]>
…python#111418) Co-authored-by: Victor Stinner <[email protected]>
(cherry picked from commit f6da790) Co-authored-by: Victor Stinner <[email protected]>
This is used to implement CPython-like hashing of numeric types e.g. in Sage or in gmpy2. Actually, the same info is available via
sys.hash_info
, so I don't see reasons to hide this in Python.h.See #106320 and #107026.
Linked PRs
The text was updated successfully, but these errors were encountered: