Skip to content

Commit 0509b8b

Browse files
fix nmod hash #373
1 parent 2e613be commit 0509b8b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/flint/test/test_all.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,8 @@ def test_nmod():
13821382
assert G(3,5) == G(8,5)
13831383
assert G(1,2) != (1,2)
13841384
assert isinstance(hash(G(3, 5)), int)
1385+
x = G(1, 7)
1386+
assert hash(x) == hash(G(1, 7))
13851387
assert raises(lambda: G([], 3), TypeError) # type: ignore
13861388
#assert G(3,5) == 8 # do we want this?
13871389
#assert 8 == G(3,5)

src/flint/types/nmod.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ cdef class nmod(flint_scalar):
9494
return NotImplemented
9595

9696
def __hash__(self):
97-
return hash((int(self.val), self.modulus))
97+
return hash((int(self.val), self.modulus()))
9898

9999
def __bool__(self):
100100
return self.val != 0

0 commit comments

Comments
 (0)