Repository: sagemath/sage

Issue:
random doctest failure in src/sage/schemes/elliptic_curves/ell_curve_isogeny.py
From [here](https://github.com/sagemath/sage/actions/runs/4120247207/jobs/7114774719#step:11:8032):

```
sage -t --random-seed=190067076934214534085190334889366968176 sage/schemes/elliptic_curves/ell_curve_isogeny.py
**********************************************************************
File "sage/schemes/elliptic_curves/ell_curve_isogeny.py", line 2966, in sage.schemes.elliptic_curves.ell_curve_isogeny.EllipticCurveIsogeny.dual
Failed example:
    E.isogeny(E.lift_x(0)).dual()
Exception raised:
    Traceback (most recent call last):
      File "/__w/sage/sage/src/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/__w/sage/sage/src/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_curve_isogeny.EllipticCurveIsogeny.dual[39]>", line 1, in <module>
        E.isogeny(E.lift_x(Integer(0))).dual()
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py", line 3076, in dual
        corr = find_post_isomorphism(mult, rhs)
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/hom.py", line 856, in find_post_isomorphism
        isos = [iso for iso in isos if iso._eval(im_phi) == im_psi]
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/hom.py", line 856, in <listcomp>
        isos = [iso for iso in isos if iso._eval(im_phi) == im_psi]
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/weierstrass_morphism.py", line 607, in _eval
        return self._codomain.base_extend(k).point(Q)
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/ell_generic.py", line 1352, in base_extend
        E = constructor.EllipticCurve([R(a) for a in self.a_invariants()])
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/ell_generic.py", line 1352, in <listcomp>
        E = constructor.EllipticCurve([R(a) for a in self.a_invariants()])
      File "sage/rings/finite_rings/element_givaro.pyx", line 1355, in sage.rings.finite_rings.element_givaro.FiniteField_givaroElement.__int__
        raise TypeError("Cannot coerce element to an integer.")
    TypeError: Cannot coerce element to an integer.
**********************************************************************
```

Another [test failure](https://github.com/sagemath/sage/actions/runs/4120251276/jobs/7114783333#step:11:8066) is due to the same issue.
random doctest failure in src/sage/schemes/elliptic_curves/ell_curve_isogeny.py
From [here](https://github.com/sagemath/sage/actions/runs/4120247207/jobs/7114774719#step:11:8032):

```
sage -t --random-seed=190067076934214534085190334889366968176 sage/schemes/elliptic_curves/ell_curve_isogeny.py
**********************************************************************
File "sage/schemes/elliptic_curves/ell_curve_isogeny.py", line 2966, in sage.schemes.elliptic_curves.ell_curve_isogeny.EllipticCurveIsogeny.dual
Failed example:
    E.isogeny(E.lift_x(0)).dual()
Exception raised:
    Traceback (most recent call last):
      File "/__w/sage/sage/src/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/__w/sage/sage/src/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.schemes.elliptic_curves.ell_curve_isogeny.EllipticCurveIsogeny.dual[39]>", line 1, in <module>
        E.isogeny(E.lift_x(Integer(0))).dual()
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py", line 3076, in dual
        corr = find_post_isomorphism(mult, rhs)
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/hom.py", line 856, in find_post_isomorphism
        isos = [iso for iso in isos if iso._eval(im_phi) == im_psi]
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/hom.py", line 856, in <listcomp>
        isos = [iso for iso in isos if iso._eval(im_phi) == im_psi]
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/weierstrass_morphism.py", line 607, in _eval
        return self._codomain.base_extend(k).point(Q)
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/ell_generic.py", line 1352, in base_extend
        E = constructor.EllipticCurve([R(a) for a in self.a_invariants()])
      File "/__w/sage/sage/src/sage/schemes/elliptic_curves/ell_generic.py", line 1352, in <listcomp>
        E = constructor.EllipticCurve([R(a) for a in self.a_invariants()])
      File "sage/rings/finite_rings/element_givaro.pyx", line 1355, in sage.rings.finite_rings.element_givaro.FiniteField_givaroElement.__int__
        raise TypeError("Cannot coerce element to an integer.")
    TypeError: Cannot coerce element to an integer.
**********************************************************************
```

Another [test failure](https://github.com/sagemath/sage/actions/runs/4120251276/jobs/7114783333#step:11:8066) is due to the same issue.


Discussion:

Resolving patch:
diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py
--- a/src/sage/schemes/elliptic_curves/ell_point.py
+++ b/src/sage/schemes/elliptic_curves/ell_point.py
@@ -254,14 +254,11 @@ def __init__(self, curve, v, check=True):
             (1 : -2 : 1)
         """
         point_homset = curve.point_homset()
+        R = point_homset.value_ring()
         if is_SchemeMorphism(v) or isinstance(v, EllipticCurvePoint_field):
             v = list(v)
         elif v == 0:
-            # some of the code assumes that E(0) has integral entries
-            # regardless of the base ring...
-            # R = self.base_ring()
-            # v = (R.zero(),R.one(),R.zero())
-            v = (0, 1, 0)
+            v = (R.zero(), R.one(), R.zero())
         if check:
             # mostly from SchemeMorphism_point_projective_field
             d = point_homset.codomain().ambient_space().ngens()
@@ -269,7 +266,7 @@ def __init__(self, curve, v, check=True):
                 raise TypeError("Argument v (= %s) must be a scheme point, list, or tuple." % str(v))
             if len(v) != d and len(v) != d-1:
                 raise TypeError("v (=%s) must have %s components" % (v, d))
-            v = Sequence(v, point_homset.value_ring())
+            v = Sequence(v, R)
             if len(v) == d-1:     # very common special case
                 v.append(v.universe()(1))
 


Test patch: