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

Commit

Permalink
Fix trac 34292
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorkarn committed Aug 6, 2022
1 parent cd1e2b1 commit 2f04cff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/sage/algebras/group_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ def _coerce_map_from_(self, S):
From: Algebra of Cyclic group of order 3 as a permutation group over Integer Ring
To: Algebra of Dihedral group of order 6 as a permutation group over Rational Field
sage: H = PermutationGroup([ [(1,2), (3,4)], [(5,6,7),(12,14,18)] ])
sage: kH = H.algebra(GF(2))
sage: [a, b] = kH.gens()
sage: x = kH(a) + kH(b) + kH.one(); print(x)
() + (5,6,7)(12,14,18) + (1,2)(3,4)
sage: x*x #checks :trac:34292
(5,7,6)(12,18,14)
As expected, there is no coercion when restricting the
field::
Expand All @@ -184,6 +192,8 @@ def _coerce_map_from_(self, S):
sage: ZG = G.algebra(ZZ, category=AdditiveMagmas())
sage: ZG.has_coerce_map_from(G)
False
"""
G = self.basis().keys()
K = self.base_ring()
Expand Down
3 changes: 2 additions & 1 deletion src/sage/structure/coerce.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1326,9 +1326,10 @@ cdef class CoercionModel:
return x_elt,y_elt
elif x_elt._parent == y_elt._parent:
# TODO: Non-uniqueness of parents strikes again!
y_elt = parent(x_elt)(y_elt)
x_elt = parent(y_elt)(x_elt)
if x_elt._parent is y_elt._parent:
return x_elt,y_elt

self._coercion_error(x, x_map, x_elt, y, y_map, y_elt)

cdef bint x_numeric = isinstance(x, (int, long, float, complex))
Expand Down

0 comments on commit 2f04cff

Please sign in to comment.