Skip to content

Commit 3de91be

Browse files
Added exception when overflowing numpy int32 during int hashing.
1 parent 4bdbb33 commit 3de91be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/emsarray/operations/cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def hash_int(hash: "hashlib._Hash", value: int) -> None:
6363
attributes: int
6464
Expects an int that can be represented in a numpy int32.
6565
"""
66-
hash.update(numpy.int32(value).tobytes())
66+
with numpy.errstate(over='raise'):
67+
hash.update(numpy.int32(value).tobytes())
6768

6869

6970
def make_cache_key(dataset: xarray.Dataset, hash: "hashlib._Hash | None" = None) -> str:

0 commit comments

Comments
 (0)