Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit 1586b77

Browse files
committed
corrected uint_to_hash
1 parent c3e3ce2 commit 1586b77

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

arraymap.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,10 @@ uint_to_hash(npy_uint64 v) {
320320
Py_hash_t hash = (Py_hash_t)(v & INT64_MAX);
321321
if (v >> 63) {
322322
hash = -hash;
323-
if (hash == -1) {
324-
return -2;
325-
}
326323
}
327-
DEBUG_MSG_OBJ("hash input", PyLong_FromUnsignedLongLong(v));
328-
DEBUG_MSG_OBJ("hash output", PyLong_FromLongLong(hash));
324+
if (hash == -1) { // might happen due to overflow on 32 bit systems
325+
return -2;
326+
}
329327
return hash;
330328
}
331329

test/test_unit.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,6 @@ def test_fam_array_get_any_b():
924924
a1 = np.array([4294967295], dtype=np.uint32)
925925
a1.flags.writeable = False
926926
a1_list = list(a1)
927-
import sys
928-
929-
print(a1, a1_list, file=sys.stderr)
930927
fam = FrozenAutoMap(a1)
931928
assert a1[0] in fam
932929
assert 4294967295 in fam

0 commit comments

Comments
 (0)