Skip to content
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

KeyBuilder: use system byteorder to match numpy #260

Merged
merged 1 commit into from
Aug 31, 2024
Merged

Conversation

inducer
Copy link
Owner

@inducer inducer commented Aug 31, 2024

Closes gh-259

@inducer inducer merged commit cee5027 into main Aug 31, 2024
17 checks passed
@inducer inducer deleted the keyb-system-byteorder branch August 31, 2024 19:45
# Must match system byte order so that numpy and this
# generate the same string of bytes.
# https://github.com/inducer/pytools/issues/259
key_hash.update(key.to_bytes(sz, byteorder=sys.byteorder, signed=True))
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, do we actually need to match the numpy representation for ints? Could we just use something like str(key) here (similar to what is used for float and complex)?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I guess that'd be better. Could you do a PR?

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.

keyb(1) == keyb(np.int64(1)) fails on ppc64 (big endian)
2 participants