Skip to content

Commit d18ce74

Browse files
author
Release Manager
committed
gh-40772: Coerce `int` to `ZZ` for `lift_x` method Currently there is a call to `x.parent()` which crashes for `x` of type `int`, but I think it should silently coerce to `ZZ` URL: #40772 Reported by: Giacomo Pope Reviewer(s):
2 parents 8acc26e + 33c5ebc commit d18ce74

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sage/schemes/elliptic_curves/ell_generic.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
from sage.rings.real_mpfr import RealField
7272
from sage.misc.cachefunc import cached_method
7373
from sage.misc.fast_methods import WithEqualityById
74+
from sage.structure.coerce import py_scalar_to_element
7475

7576
# Schemes
7677
import sage.schemes.projective.projective_space as projective_space
@@ -922,8 +923,15 @@ def lift_x(self, x, all=False, extend=False):
922923
sage: E = EllipticCurve(F, [1,1])
923924
sage: {E.lift_x(t+1) for _ in range(1000)} # but .lift_x() uses a fixed one
924925
{(t + 1 : 39*t^2 + 14*t + 12 : 1)}
926+
927+
Check python types::
928+
929+
sage: E = EllipticCurve('37a').short_weierstrass_model().change_ring(GF(17))
930+
sage: E.lift_x(int(7), all=True)
931+
[(7 : 3 : 1), (7 : 14 : 1)]
925932
"""
926933
K = self.base_ring()
934+
x = py_scalar_to_element(x)
927935
L = x.parent()
928936
E = self
929937

0 commit comments

Comments
 (0)