#14895: Segfault when exponentiating an integer with I.pyobject()
-------------------------------+------------------------
       Reporter:  eviatarbach  |        Owner:  burcin
           Type:  defect       |       Status:  new
       Priority:  critical     |    Milestone:  sage-6.2
      Component:  symbolics    |   Resolution:
       Keywords:               |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+------------------------

Old description:

> Try, for example, `2^I.pyobject()`.
>
> This is a critical issue since any method of a class inheriting from
> `BuiltinFunction` will receive the I pyobject if I is passed as an
> argument to the function.

New description:

 Try, for example, `2^I.pyobject()`.

 This is a critical issue since any method of a class inheriting from
 `BuiltinFunction` will receive the I pyobject if I is passed as an
 argument to the function.

 This in turn leads to segfaults like:
 {{{
 sage: K.<a> = NumberField(x^2+1)
 sage: 2^a
 }}}
 or
 {{{
 sage: K.<sqrt2> = QuadraticField(2)
 sage: 2^sqrt2
 }}}

--

Comment (by rws):

 Pingpong between parent and base.

 `rings/rational.pyx` (`Rational._pow_()`):
 {{{
             if PY_TYPE_CHECK(n, Element):
                 return (<Element>n)._parent(self)**n
             try:
                 return n.parent()(self)**n
 }}}
 `rings/number_field/number_field_element.pyx`
 (`NumberFieldElement._pow_()`):
 {{{
             from sage.symbolic.ring import SR
             try:
                 res = QQ(base)**exp
             except TypeError:
                 pass
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/14895#comment:3>
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.

Reply via email to