From acdfe74fe828fb031ae779532fe5e805538ffe23 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Sun, 3 Aug 2025 19:29:16 +0700 Subject: [PATCH] Make Jacobian morphisms hashable --- .../schemes/hyperelliptic_curves/jacobian_morphism.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py index 8194f25f45c..6d81ef23c68 100644 --- a/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py +++ b/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py @@ -403,7 +403,7 @@ def __init__(self, parent, polys, check=True): genus = C.genus() if a.degree() > genus: polys = cantor_reduction(a, b, f, h, genus) - self.__polys = polys + self.__polys = tuple(polys) def _printing_polys(self): r""" @@ -633,7 +633,7 @@ def __tuple__(self): sage: tuple(P) # indirect doctest # needs sage.rings.number_field (x - 1, -a) """ - return tuple(self.__polys) + return self.__polys def __getitem__(self, n): r""" @@ -662,9 +662,9 @@ def __getitem__(self, n): sage: P[-1] # indirect doctest -a sage: P[:1] # indirect doctest - [x - 1] + (x - 1,) """ - return list(self.__polys)[n] + return self.__polys[n] def _richcmp_(self, other, op): r""" @@ -724,6 +724,9 @@ def _richcmp_(self, other, op): # comparing polynomials is well-defined return richcmp(self.__polys, other.__polys, op) + def __hash__(self): + return hash(self.__polys) + def __bool__(self): r""" Return ``True`` if this divisor is not the additive identity element.