[Cython] Propagating exceptions with functions which returns void*
Daniele Pianu
muogoro at gmail.com
Tue Feb 3 11:30:26 CET 2009
Probably I've not completely understood the C-function
exception-propagating mechanism. I've a function with a prototype like
this
void* getItem( void* self, int i )
The function returns the i-th item in self. Some index and bounds
checking are implemented, so if, for example, I specify a negative
index or an index out of self bounds I raise and exception. In cython
the function is declared in this way:
cdef void* getItem( void* self, int i ) except NULL
But when an error occurs and the exception is raised I always receive
a message which says that the exception is ignored. Obviously, the
function continues its execution and terminates whit a segmentation
fault.
The question is: how can I propagate to caller functions the raised exception?
Thanks for your help (and for the great work that you've done with cython :D ),
Daniele
More information about the Cython-dev
mailing list