Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 1a1976c

Browse files
committed
Import sage_eval
1 parent abc5a70 commit 1a1976c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sage/rings/fraction_field.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,11 @@ def _element_constructor_(self, x, y=1, coerce=True):
530530
sage: S(pari(x + y + 1/z))
531531
(x*z + y*z + 1)/z
532532
533-
Test a failed conversion::
533+
Test conversions where `y` is a string but `x` not::
534534
535535
sage: K = ZZ['x,y'].fraction_field()
536+
sage: K._element_constructor_(2, 'x+y')
537+
2/(x + y)
536538
sage: K._element_constructor_(1, 'z')
537539
Traceback (most recent call last):
538540
...
@@ -554,6 +556,7 @@ def _element_constructor_(self, x, y=1, coerce=True):
554556
raise TypeError("unable to evaluate {!r} in {}".format(x, self))
555557
recurse = True
556558
if isinstance(y, basestring):
559+
from sage.misc.sage_eval import sage_eval
557560
try:
558561
y = sage_eval(y, self.gens_dict_recursive())
559562
except NameError:

0 commit comments

Comments
 (0)