diff --git a/README.md b/README.md index d6b38322..86e48630 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,7 @@ Contributors (0.9.0): - Agriya Khetarpal (AK) - Oscar Benjamin (OB) - Daniel Simmons-Marengo (DSM) +- ForeverHaibara (FH) Changes (0.9.0): @@ -196,6 +197,7 @@ Changes (0.9.0): Faster conversion from `int` to `fmpz` and back. (RO). - [gh-359](https://github.com/flintlib/python-flint/pull/359), Sort factorisations of all mpoly types. (OB) +- [gh-374](https://github.com/flintlib/python-flint/pull/374), Fixed a bug in `nmod.__hash__`. (FH) 0.8.0 ----- diff --git a/src/flint/test/test_all.py b/src/flint/test/test_all.py index 1505d547..d1a924c6 100644 --- a/src/flint/test/test_all.py +++ b/src/flint/test/test_all.py @@ -1382,6 +1382,8 @@ def test_nmod(): assert G(3,5) == G(8,5) assert G(1,2) != (1,2) assert isinstance(hash(G(3, 5)), int) + x = G(1, 7) + assert hash(x) == hash(G(1, 7)) assert raises(lambda: G([], 3), TypeError) # type: ignore #assert G(3,5) == 8 # do we want this? #assert 8 == G(3,5) diff --git a/src/flint/types/nmod.pyx b/src/flint/types/nmod.pyx index 0f4d7c3f..6c771f0f 100644 --- a/src/flint/types/nmod.pyx +++ b/src/flint/types/nmod.pyx @@ -94,7 +94,7 @@ cdef class nmod(flint_scalar): return NotImplemented def __hash__(self): - return hash((int(self.val), self.modulus)) + return hash((int(self.val), self.modulus())) def __bool__(self): return self.val != 0