[sage-devel] Re: Cython and Python signal

2013-05-12 Thread Nils Bruin
On May 12, 6:50 pm, leif wrote: > With Sage 5.10.beta1, (the custom SIGALRM handler gets called as > expected and) I get a traceback, but only after much more than 10 > seconds -- I'd say exactly *after* maxima_eval() returned [normally], > which is (almost) the same behaviour as with factor() usi

[sage-devel] Re: Cython and Python signal

2013-05-12 Thread leif
Nils Bruin wrote: Incidentally, note: sage: alarm(10); integrate(cos(x*sin(x)^10),x) KeyboardInterrupt: computation timed out because alarm was set for 10 seconds so somehow the SIGALRM gets reacted on properly by ECL (which has its own signal handler) and somehow the condition arrives in its p

[sage-devel] Re: Cython and Python signal

2013-05-12 Thread Nils Bruin
On May 12, 4:17 pm, leif wrote: > It doesn't seem Python would execute *any* code of the custom (Python) > handler (as opposed to just deferring the raise KeyboardInterrupt or > what follows it) before the Cython function returns by other means. Looking at the Python code base (and using common

[sage-devel] Re: Cython and Python signal

2013-05-12 Thread leif
Nils Bruin wrote: Probably more importantly, the signal handler that misc.alarm installs is: def __mysig(a,b): raise KeyboardInterrupt, "computation timed out because alarm was set for %s seconds"%__alarm_time Given that installing this handler delays the handling of the SIGALRM, I guess w

[sage-devel] Re: Cython and Python signal

2013-05-12 Thread Nils Bruin
On May 11, 9:44 pm, William Stein wrote: > By the way, the alarm function in Sage uses Python's "signal.alarm", > whose source code is this: > > static PyObject * > signal_alarm(PyObject *self, PyObject *args) > { >     int t; >     if (!PyArg_ParseTuple(args, "i:alarm", &t)) >         return NULL

Re: [sage-devel] Re: Cython and Python signal

2013-05-11 Thread William Stein
On Sat, May 11, 2013 at 8:05 PM, leif wrote: > William Stein wrote: >> >> On Sat, May 11, 2013 at 6:19 PM, Nils Bruin wrote: >>> >>> On May 11, 2:15 pm, Thierry wrote: Hi, it was reported inhttp://ask.sagemath.org/question/2567/kill-the-thread-in-a-long-compu... tha

[sage-devel] Re: Cython and Python signal

2013-05-11 Thread leif
William Stein wrote: On Sat, May 11, 2013 at 6:19 PM, Nils Bruin wrote: On May 11, 2:15 pm, Thierry wrote: Hi, it was reported inhttp://ask.sagemath.org/question/2567/kill-the-thread-in-a-long-compu... that cython seems not to handle Python signals correctly. It-it a feature or should-it be

Re: [sage-devel] Re: Cython and Python signal

2013-05-11 Thread William Stein
On Sat, May 11, 2013 at 6:19 PM, Nils Bruin wrote: > On May 11, 2:15 pm, Thierry wrote: >> Hi, >> >> it was reported >> inhttp://ask.sagemath.org/question/2567/kill-the-thread-in-a-long-compu... >> that cython seems not to handle Python signals correctly. It-it a >> feature or should-it be repor

[sage-devel] Re: Cython and Python signal

2013-05-11 Thread Nils Bruin
On May 11, 2:15 pm, Thierry wrote: > Hi, > > it was reported > inhttp://ask.sagemath.org/question/2567/kill-the-thread-in-a-long-compu... > that cython seems not to handle Python signals correctly. It-it a > feature or should-it be reported ? I think it's a feature. There's a lot of code that re