#19553: Issue with convert maps for facade parents
------------------------+-----------------------------
   Reporter:  tscrim    |            Owner:  tscrim
       Type:  defect    |           Status:  new
   Priority:  major     |        Milestone:  sage-6.10
  Component:  coercion  |         Keywords:
  Merged in:            |          Authors:
  Reviewers:            |  Report Upstream:  N/A
Work issues:            |           Branch:
     Commit:            |     Dependencies:
   Stopgaps:            |
------------------------+-----------------------------
 Consider the following:
 {{{
 sage: class Foo(Parent):
 ....:     def __init__(self):
 ....:         Parent.__init__(self, facade=True, category=Sets())
 ....:     def _element_constructor_(self, x):
 ....:         return int(x)
 sage: F = Foo()
 sage: F(5)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 ...
 TypeError: Cannot convert int to sage.structure.element.Element
 sage: mor = F.convert_map_from(ZZ)
 sage: mor
 Conversion map:
   From: Integer Ring
   To:   <class '__main__.Foo_with_category'>
 sage: mor(5)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 ...
 TypeError: Cannot convert int to sage.structure.element.Element
 }}}
 which comes from the coercion framework creating a
 `DefaultConvertMap_unique` whose `_call_` method returns an `int`, since
 `S` is a facade for `int`'s, which cannot be converted to an `Element`.

--
Ticket URL: <http://trac.sagemath.org/ticket/19553>
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/d/optout.

Reply via email to