Hi,

Andrew Straw wrote:
> According to the documentation for PyErr_CheckSignals() (at
> http://docs.python.org/c-api/exceptions.html#PyErr_CheckSignals ), the
> KeyboardInterrupt is already raised.

In that case, if you need this inside a cdef function, you can declaring it
as "except *" and simply return from the function if a signal was set. The
caller will always check if an exception was raised and propagate the
KeyboardInterrupt.

If your cdef function returns a C type (like int, for example) that allows
passing a dedicated exception value (like -1), you can also declare it
"except -1" and then return -1 explicitly on signals. That will allow the
caller to know that an error was raised without checking.

http://docs.cython.org/docs/language_basics.html#error-return-values

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to