#14989: Conversion failure from `ZZ[i]` to `CC`
----------------------------+-----------------------------
Reporter: mmezzarobba | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.12
Component: misc | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Dependencies: | Stopgaps:
----------------------------+-----------------------------
`ComplexField_class._element_constructor_` calls `x.parent().polynomial()`
when `isinstance(x, NumberFieldElement_quadratic)`, but not all objects of
class `NumberFieldElement_quadratic` have a number field as a parent. As a
consequence, the following conversion (that I guess really should work,
since it is suggested by `pushout()`) fails.
{{{
sage: QQi.<i> = NumberField(x^2+1, embedding=1.*I)
sage: O = QQi.order(i)
sage: from sage.categories.pushout import pushout
sage: pushout(O, CC)
Complex Field with 53 bits of precision
sage: CC(O.gen(1))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
<ipython-input-23-dbf70e6b573a> in <module>()
----> 1 CC(O.gen(Integer(1)))
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/rings/complex_field.pyc in __call__(self, x, im)
345 if im is not None:
346 x = x, im
--> 347 return Parent.__call__(self, x)
348
349 def _element_constructor_(self, x):
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
(sage/structure/parent.c:8134)()
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3856)()
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3757)()
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/rings/complex_field.pyc in _element_constructor_(self, x)
366
367 late_import()
--> 368 if isinstance(x, NumberFieldElement_quadratic) and
list(x.parent().polynomial()) == [1, 0, 1]:
369 (re, im) = list(x)
370 return complex_number.ComplexNumber(self, re, im)
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/structure/parent.so in
sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6662)()
/home/marc/co/sage/local/lib/python2.7/site-
packages/sage/structure/misc.so in
sage.structure.misc.getattr_from_other_class
(sage/structure/misc.c:1606)()
AttributeError: 'AbsoluteOrder_with_category' object has no attribute
'polynomial'
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/14989>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.