question about _sig_on _sig_off in cython code

4 views
Skip to first unread message

luisfe

unread,
Jun 28, 2010, 1:20:25 PM6/28/10
to sage-devel
Hi,

I have found an unhandled SIGFPE in number_field_element_quadratic as
explained in ticket http://trac.sagemath.org/sage_trac/ticket/9357

Basically, sage does not check if a quadratic algebraic number is zero
when trying to invert it.

I added a trivial patch that checks if the zero element is being
inverted to rise a ZeroDivisionError. However, the error message
before the crash suggests that the compiled code is not properly
wrapped with _sig_on _sig_off.

In this example even if one adds this wrapper the zero check is
advisable, since _sing_on would rise a RuntimeError instead a
ZeroDivisionError, so it seems that the zero check is enough in this
case. On the other hand would the _sig_on stuff made the code more
robust? What is the way to proceed in this cases?

Thanks,

Luis

Robert Bradshaw

unread,
Jun 30, 2010, 3:29:14 AM6/30/10
to sage-...@googlegroups.com

You did the right thing. The _sig_on and _sig_off are more about being
able to trap signals such as interrupts (so that control-C works).

- Robert


David Kirkby

unread,
Jul 1, 2010, 6:23:50 AM7/1/10
to sage-...@googlegroups.com

Is there any quick way of finding code which might not be wrapped
properly with sig_on and sig_off? I think the seg fault I get at
startup indicates that as a possible problem. (Not sure. Forget error
message and can't check now. Batteries just about to die in laptop)

Reply all
Reply to author
Forward
0 new messages