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

Commit

Permalink
fix coercion of Laurent into fraction fields
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Feb 14, 2022
1 parent 826061a commit ed5f0ca
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sage/rings/fraction_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ def _coerce_map_from_(self, S):
sage: 1/(R.gen(0) + R.gen(1))
1/(x + y)
Test for :trac:`31320`::
sage: FQt = Frac(QQ['t'])
sage: LCt = LaurentPolynomialRing(CC,'t')
sage: coercion_model.common_parent(FQt, LCt)
Fraction Field of Univariate Polynomial Ring in t
over Complex Field with 53 bits of precision
Coercion from a localization::
sage: R.<x> = ZZ[]
Expand Down Expand Up @@ -333,7 +341,8 @@ def wrapper(x):
parent_as_first_arg=False)

# special treatment for LaurentPolynomialRings
if isinstance(S, LaurentPolynomialRing_generic):
if (isinstance(S, LaurentPolynomialRing_generic) and
self._R.has_coerce_map_from(S.base_ring())):
def converter(x, y=None):
if y is None:
return self._element_class(self, *x._fraction_pair())
Expand Down

0 comments on commit ed5f0ca

Please sign in to comment.