Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle FLINT exceptions gracefully #17629

Closed
rwst opened this issue Jan 13, 2015 · 18 comments
Closed

Handle FLINT exceptions gracefully #17629

rwst opened this issue Jan 13, 2015 · 18 comments

Comments

@rwst
Copy link

rwst commented Jan 13, 2015

Sage crashes with

sage: (x^2222222222+1).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:

Depends on #17668

Component: c_lib

Keywords: flint_memory_error

Author: Jeroen Demeyer

Branch/Commit: 4835d4b

Reviewer: Ralf Stephan

Issue created by migration from https://trac.sagemath.org/ticket/17629

@rwst rwst added this to the sage-6.5 milestone Jan 13, 2015
@rwst
Copy link
Author

rwst commented Jan 13, 2015

Attachment: sage_crash_mG0GBp.log

crash report

@rwst

This comment has been minimized.

@rwst rwst changed the title crash with SR(fraction).polynomial(QQ) FLINT crash with SR(fraction).polynomial(QQ) Jan 25, 2015
@rwst
Copy link
Author

rwst commented Jan 25, 2015

comment:3

Has nothing to do with fraction, crashes with only x^2222222222+1 too. If this is memory, can we work around with sparse polynomials, at least give the user the option?

@rwst
Copy link
Author

rwst commented Jan 25, 2015

Changed keywords from conversion to conversion, sparse, dense

@rwst

This comment has been minimized.

@rwst rwst changed the title FLINT crash with SR(fraction).polynomial(QQ) FLINT crash with expression.polynomial() Jan 25, 2015
@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

comment:4

Sparse polynomials should be a different ticket.

@jdemeyer
Copy link

Changed keywords from conversion, sparse, dense to flint_memory_error

@rwst
Copy link
Author

rwst commented Feb 14, 2015

comment:5

Replying to @jdemeyer:

Sparse polynomials should be a different ticket.

See #17782 (EDIT)

@jdemeyer
Copy link

Author: Jeroen Demeyer

@jdemeyer
Copy link

Dependencies: #17668

@jdemeyer

This comment has been minimized.

@jdemeyer jdemeyer changed the title FLINT crash with expression.polynomial() Handle FLINT exceptions gracefully Feb 14, 2015
@jdemeyer
Copy link

Branch: u/jdemeyer/ticket/17629

@jdemeyer
Copy link

Commit: 4835d4b

@jdemeyer
Copy link

New commits:

47217bcReplace PY_NEW and PY_NEW_SAME_TYPE by Cython code
4835d4bHandle FLINT exceptions gracefully

@rwst
Copy link
Author

rwst commented Feb 17, 2015

Reviewer: Ralf Stephan

@rwst
Copy link
Author

rwst commented Feb 17, 2015

comment:9

Except for cosmetics this practically replaces sig_on with sig_str(...) in FLINT code and adds an exception for 0(-1). It also passes make ptestlong. So, depending on the review for #17668 this is fine.

@vbraun
Copy link
Member

vbraun commented Feb 17, 2015

Changed branch from u/jdemeyer/ticket/17629 to 4835d4b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants