Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-111389: expose _PyHASH_INF/BITS/MODULUS/IMAG macros as public#111418

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

skirpichev
Copy link
Contributor

@skirpichevskirpichev commentedOct 28, 2023
edited
Loading

@skirpichevskirpichevforce-pushed therestore-pyhash-and-pylongnew branch from1edec34 to0ce377aCompareOctober 28, 2023 03:52
@vstinner
Copy link
Member

I would prefer to make them public if they are useful.

@skirpichev
Copy link
ContributorAuthor

I would prefer to make them public if they are useful.

@vstinner, are you about documenting these macroses somewhere (I proposehttps://docs.python.org/3/library/sys.html#sys.hash_info, where we could mention them in descriptions for different fields) AND about renaming them too (add PyUnstable_ aliases)?

@skirpichevskirpichevforce-pushed therestore-pyhash-and-pylongnew branch from1f9f2fc to2c6002fCompareOctober 29, 2023 04:52
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please don't document private APIs.

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@vstinner
Copy link
Member

If you want to document these constants, make them public.

@ngoldbaum
Copy link
Contributor

It looks like numpy uses_Py_HashDouble to hash numpy scalars. If we're going to expose these symbols again, is there any appetite for exposing the functions used by them in the unstable API? If not it looks like it should be straightforward to vendor the code assuming there aren't any hidden issues for making the hash values of numpy scalars possibly differ from python scalars in the future.

seberg reacted with thumbs up emoji

@skirpichev
Copy link
ContributorAuthor

If you want to document these constants, make them public.

Ok, I've added PyUnstable prefixes. If that's ok, I'll add a news entry.

The other option is to revert to 0ce377a. I don't think we could just remove underscores, given the_PyHASH_NAN example.

I have made the requested changes; please review again

BTW, maybe we shouldn't export_PyHASH_BITS. This parameter is not available insys.hash_info and examples for hashing in the docs show how to avoid using one. I'll try to patch gmpy2 to remove it's usage (seems to be trivial for mpq, but may be less efficient for mpfr). I think same could be done for the Sage.

It looks like numpy uses _Py_HashDouble to hash numpy scalars.

@ngoldbaum FYI:#91744 (comment)

@skirpichev
Copy link
ContributorAuthor

I have made the requested changes; please review again

@skirpichev
Copy link
ContributorAuthor

I didn't expect the Spanish Inquisition

@skirpichev
Copy link
ContributorAuthor

@vstinner, not sure why bot isn't working, butI think I did requested changes.

@vstinner
Copy link
Member

Sorry, I was struggling with#111089 this week. I will try to go through all#111481 issues next week.

skirpichev reacted with thumbs up emoji

@skirpichev
Copy link
ContributorAuthor

BTW, maybe we shouldn't export _PyHASH_BITS.

Hmm, no, it seems we really want this, e.g.:aleaxit/gmpy#452 (see first removed commit). Then maybe we should expose this in sys.hash_info struct too?

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm working on PR#112095 which adds an "infrastructure" to test the PyHash API. I suggest waiting until this PR is merged before considering exposing these constants to the public C API.

@skirpichevskirpichev changed the titlegh-111389: restoring _PyHASH_INF/BITS/MODULUS/IMAG macroses as publicgh-111389: expose _PyHASH_INF/BITS/MODULUS/IMAG macros as publicNov 16, 2023
Was rendered: "See also the PyTypeObject.tp_hash member and Hashingof numeric types for more details about hashing of numeric types."
@skirpichev
Copy link
ContributorAuthor

Perhaps, I should usePy_HASH_* naming convention? (Given#112449)

@skirpichev
Copy link
ContributorAuthor

@vstinner,#112449 was closed. On another hand,Py_HashPointer() function was added. Does it make sense to keep this pr?

@skirpichev
Copy link
ContributorAuthor

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, I just suggest to add a comment.

@mdickinson: Would you mind to double check this PR?

Copy link
Member

@mdickinsonmdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks fine to me.

@vstinnervstinner merged commit1e68c4b intopython:mainMar 9, 2024
@vstinner
Copy link
Member

Merged, thank you@skirpichev.

@skirpichevskirpichev deleted the restore-pyhash-and-pylongnew branchMarch 10, 2024 00:11
@skirpichev
Copy link
ContributorAuthor

Thanks to all for review and patience.

vstinner reacted with thumbs up emoji

adorilson pushed a commit to adorilson/cpython that referenced this pull requestMar 25, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull requestApr 17, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner approved these changes

@mdickinsonmdickinsonmdickinson approved these changes

@tirantiranAwaiting requested review from tirantiran is a code owner

@gpsheadgpsheadAwaiting requested review from gpsheadgpshead is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@skirpichev@vstinner@ngoldbaum@mdickinson

[8]ページ先頭

©2009-2025 Movatter.jp