Skip to content

Fix usize not using the same hash as PyInt when used as key into a di… #5756

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

Merged
merged 7 commits into from
May 1, 2025

Conversation

hbina
Copy link
Contributor

@hbina hbina commented Apr 29, 2025

…ctionary

@hbina hbina force-pushed the hbina-fix-hash-usize branch from 4e8d34d to 78809a5 Compare April 30, 2025 13:19
@@ -86,6 +86,11 @@ pub fn hash_pointer(value: usize) -> PyHash {
hash as _
}

#[inline]
pub fn hash_integer<T: num_traits::PrimInt>(data: T) -> PyHash {
Copy link
Member

Choose a reason for hiding this comment

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

To avoid unnecessarily complicated error handlings, pub fn hash_usize(data: usize) will be enough.
Let's place this function beside hash_bigint to find each other easier

@youknowone youknowone merged commit 253cc4e into RustPython:main May 1, 2025
@youknowone
Copy link
Member

uh, CI didn't run for last fix

@youknowone youknowone mentioned this pull request May 1, 2025
@hbina hbina deleted the hbina-fix-hash-usize branch May 1, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants