The current way of dealing with this is to abort() in the C library,
which will raise RuntimeError inside sig_on()/sig_off().  Something like::

#include "c_lib/include/interrupt.h"
void libgap_division_by_zero()
{
    set_sage_signal_handler_message("GAP: Division by zero");
    abort();
}

Then in your Cython code::

cdef class GapElement(RingElement):
    # ....
    cpdef RingElement _div_(self, RingElement right):
        sig_on()
        e = make_GapElement(QUO(self.value(<GapElement>right).value))
        sig_off()
        return e

See #10109 for some documentation on this.

I plan to make a better interface to handle errors from C library code
(and use that at least for PARI and NTL but potentially also GAP).  But
this would depend on #9678, #10061, #10258, #10030.


Jeroen.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to