Reputation: 3181
if i declare a c++ function in a pxd file without except +
at the end, but still do try/catch on my python calling code, except i catch everything or just catch 'RuntimeError', won't that have same effect as having except +
? According to http://docs.cython.org/en/latest/src/userguide/wrapping_CPlusPlus.html#exceptions, most of C++ exceptions will be converted to RuntimeError anyway even with except +.
Upvotes: 1
Views: 73
Reputation: 30919
No that will not work.
except +
is the indicator that tells Cython to generate the code that converts C++ exceptions to a Python exception. Without it Cython will assume that the function cannot throw a C++ exception and the C++ exception will propagate through the Cython code breaking everything.
Upvotes: 1