diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index 90bc4519082..bd7cfc8239d 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -36,10 +36,8 @@ _Fields = Fields() from sage.structure.sequence import Sequence -from sage.structure.element import parent +from sage.structure.element import parent, Expression from sage.structure.factory import UniqueFactory -from sage.symbolic.ring import SR -from sage.symbolic.expression import is_SymbolicEquation class EllipticCurveFactory(UniqueFactory): @@ -385,6 +383,20 @@ def create_key_and_extra_args(self, x=None, y=None, j=None, minimal_twist=True, incorrect data may lead to wrong results of computations instead of errors or warnings. + TESTS:: + + sage: var('x', 'y', 'v', 'w') + (x, y, v, w) + sage: EllipticCurve(y^2 + y > x^3 + x - 9) + Traceback (most recent call last): + ... + ValueError: no symbolic relations other than equalities are allowed + sage: E = EllipticCurve(y^2 + y == x^3 + x - 9) + sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) + True + sage: R. = QQ[] + sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 )) + True """ R = None if is_Ring(x): @@ -400,10 +412,13 @@ def create_key_and_extra_args(self, x=None, y=None, j=None, minimal_twist=True, raise ValueError("First parameter (if present) must be a ring when j is specified") x = coefficients_from_j(j, minimal_twist) - if is_SymbolicEquation(x): + if isinstance(x, Expression) and x.is_relational(): + import operator + if x.operator() != operator.eq: + raise ValueError("no symbolic relations other than equalities are allowed") x = x.lhs() - x.rhs() - if parent(x) is SR: + if isinstance(parent(x), sage.rings.abc.SymbolicRing): x = x._polynomial_(rings.QQ['x', 'y']) if is_MPolynomial(x):