Skip to content

Commit 2da28fe

Browse files
Merge pull request #374 from ForeverHaibara/fix-nmod-hash
Fix nmod hash
2 parents 2e613be + e74c8f8 commit 2da28fe

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ Contributors (0.9.0):
172172
- Agriya Khetarpal (AK)
173173
- Oscar Benjamin (OB)
174174
- Daniel Simmons-Marengo (DSM)
175+
- ForeverHaibara (FH)
175176

176177
Changes (0.9.0):
177178

@@ -196,6 +197,7 @@ Changes (0.9.0):
196197
Faster conversion from `int` to `fmpz` and back. (RO).
197198
- [gh-359](https://github.com/flintlib/python-flint/pull/359),
198199
Sort factorisations of all mpoly types. (OB)
200+
- [gh-374](https://github.com/flintlib/python-flint/pull/374), Fixed a bug in `nmod.__hash__`. (FH)
199201

200202
0.8.0
201203
-----

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)