#20693: Sage crashes when computing newforms
---------------------------------+------------------------
Reporter: ehlen | Owner:
Type: defect | Status: new
Priority: critical | Milestone: sage-7.3
Component: modular forms | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------+------------------------
Comment (by pbruin):
Another solution, using PARI as a fallback (now testing):
{{{
#!diff
--- a/src/sage/rings/number_field/number_field_element.pyx
+++ b/src/sage/rings/number_field/number_field_element.pyx
@@ -40,6 +40,8 @@ from sage.libs.gmp.mpz cimport *
from sage.libs.gmp.mpq cimport *
from sage.libs.mpfi cimport mpfi_t, mpfi_init, mpfi_set, mpfi_clear,
mpfi_div_z, mpfi_init2, mpfi_get_prec, mpfi_set_prec
from sage.libs.mpfr cimport mpfr_less_p, mpfr_greater_p,
mpfr_greaterequal_p
+from sage.libs.ntl.error import NTLError
+
from cpython.object cimport Py_EQ, Py_NE, Py_LT, Py_GT, Py_LE, Py_GE
from sage.structure.sage_object cimport rich_to_bool
@@ -2297,9 +2299,14 @@ cdef class NumberFieldElement(FieldElement):
if IsZero_ZZX(self.__numerator):
raise ZeroDivisionError
cdef NumberFieldElement x
- x = self._new()
- self._invert_c_(&x.__numerator, &x.__denominator)
- x._reduce_c_()
+ try:
+ x = self._new()
+ sig_on()
+ self._invert_c_(&x.__numerator, &x.__denominator)
+ x._reduce_c_()
+ sig_off()
+ except NTLError:
+ x = self._parent(~self._pari_())
return x
def _integer_(self, Z=None):
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/20693#comment:23>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.