#17629: crash with SR(fraction).polynomial(QQ)
---------------------------------------+------------------------
       Reporter:  rws                  |        Owner:
           Type:  defect               |       Status:  new
       Priority:  critical             |    Milestone:  sage-6.5
      Component:  commutative algebra  |   Resolution:
       Keywords:  conversion           |    Merged in:
        Authors:                       |    Reviewers:
Report Upstream:  N/A                  |  Work issues:
         Branch:                       |       Commit:
   Dependencies:                       |     Stopgaps:
---------------------------------------+------------------------
Description changed by rws:

Old description:

> Sage crashes with
> {{{
> sage: ((x^2222222222+1)/(x+1))
> (x^2222222222 + 1)/(x + 1)
> sage: _.polynomial(QQ)
> ...
> #2  0x00007f46536d606d in sigdie()
> #3  0x00007f46536d575a in sage_signal_handler()
> #4  0x00007f46596f03e0 in __restore_rt()
> #5  0x00007f46590e70a0 in raise()
> #6  0x00007f465865c3a0 in abort()
> #7  0x00007f4645da4b40 in flint_memory_error()
> #8  0x00007f4645daa400 in flint_calloc()
> #9  0x00007f4645e00150 in fmpq_poly_realloc()
> #10 0x00007f4645e058a0 in fmpq_poly_fit_length()
> #11 0x00007f4645dff850 in fmpq_poly_set_coeff_si()
> #12 0x00007f463c1b6f30 in
> __pyx_pf_4sage_5rings_10polynomial_25polynomial_rational_flint_25Polynomial_rational_flint_58__pow__()
> at
> /home/ralf/sage/src/build/cythonized/sage/rings/polynomial/polynomial_rational_flint.cpp:10287
>   10282     *             if self._is_gen:
>   10283     *                 fmpq_poly_set_coeff_si(res.__poly, n, 1)
> # <<<<<<<<<<<<<<
>   10284     *             else:
>   10285     *                 sig_on()
>   10286     */
> > 10287          fmpq_poly_set_coeff_si(__pyx_v_res->__pyx___poly,
> __pyx_v_n, 1);
>   10288          goto __pyx_L16;
>   10289        }
>   10290        /*else*/ {
>   10291
> #13 0x00007f465933e270 in ternary_op()
> #14 0x00007f4659340520 in PyNumber_Power()
> #15 0x00007f46593e62b0 in arithmetic() at
> /home/ralf/sage/local/lib/python2.7/site-
> packages/sage/symbolic/expression_conversions.py:1110
>   1105            if not any(repr(v) in self.varnames for v in
> ex.variables()):
>   1106                return self.base_ring(ex)
>   1107            elif operator == _operator.pow:
>   1108                from sage.rings.all import Integer
>   1109                base, exp = ex.operands()
> > 1110                return self(base)**Integer(exp)
>   1111            else:
>   }}}
> Rather, it should throw `TypeError: denominator must be a unit` like it
> does with `polynomial(ZZ)`.

New description:

 Sage crashes with
 {{{
 sage: ((x^2222222222+1)/(x+1))
 (x^2222222222 + 1)/(x + 1)
 sage: _.polynomial(QQ)
 ...
 #2  0x00007f46536d606d in sigdie()
 #3  0x00007f46536d575a in sage_signal_handler()
 #4  0x00007f46596f03e0 in __restore_rt()
 #5  0x00007f46590e70a0 in raise()
 #6  0x00007f465865c3a0 in abort()
 #7  0x00007f4645da4b40 in flint_memory_error()
 #8  0x00007f4645daa400 in flint_calloc()
 #9  0x00007f4645e00150 in fmpq_poly_realloc()
 #10 0x00007f4645e058a0 in fmpq_poly_fit_length()
 #11 0x00007f4645dff850 in fmpq_poly_set_coeff_si()
 #12 0x00007f463c1b6f30 in
 
__pyx_pf_4sage_5rings_10polynomial_25polynomial_rational_flint_25Polynomial_rational_flint_58__pow__()
 at
 
/home/ralf/sage/src/build/cythonized/sage/rings/polynomial/polynomial_rational_flint.cpp:10287
   10282     *             if self._is_gen:
   10283     *                 fmpq_poly_set_coeff_si(res.__poly, n, 1)
 # <<<<<<<<<<<<<<
   10284     *             else:
   10285     *                 sig_on()
   10286     */
 > 10287          fmpq_poly_set_coeff_si(__pyx_v_res->__pyx___poly,
 __pyx_v_n, 1);
   10288          goto __pyx_L16;
   10289        }
   10290        /*else*/ {
   10291
 #13 0x00007f465933e270 in ternary_op()
 #14 0x00007f4659340520 in PyNumber_Power()
 #15 0x00007f46593e62b0 in arithmetic() at
 /home/ralf/sage/local/lib/python2.7/site-
 packages/sage/symbolic/expression_conversions.py:1110
   1105            if not any(repr(v) in self.varnames for v in
 ex.variables()):
   1106                return self.base_ring(ex)
   1107            elif operator == _operator.pow:
   1108                from sage.rings.all import Integer
   1109                base, exp = ex.operands()
 > 1110                return self(base)**Integer(exp)
   1111            else:
   }}}
 Rather, it should throw `TypeError: denominator must be a unit` like it
 does with `1/(1+x)`, or `OverflowError: value too large to convert to int`
 with `polynomial(ZZ)`.

--

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