Skip to content

Commit

Permalink
Revert "KeyBuilder: use system byteorder to match numpy"
Browse files Browse the repository at this point in the history
This reverts commit cee5027.
  • Loading branch information
matthiasdiener committed Jan 16, 2025
1 parent 99d91be commit 668b7fe
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pytools/persistent_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ class KeyBuilder:
may stop working as early as 2022.
.. versionadded:: 2021.2
.. note::
Some key-building uses system byte order, so the built keys may not match
across different systems. It would be desirable to fix this, but this is
not yet done.
"""

# this exists so that we can (conceivably) switch algorithms at some point
Expand Down Expand Up @@ -277,10 +271,7 @@ def update_for_int(self, key_hash: Hash, key: int) -> None:
sz = 8
while True:
try:
# 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))
key_hash.update(key.to_bytes(sz, byteorder="little", signed=True))
return
except OverflowError:
sz *= 2
Expand Down

0 comments on commit 668b7fe

Please sign in to comment.