[Pyrex] C++ exceptions

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 20 11:24:01 CEST 2006


Steve Howe wrote:

> Just to make sure: currently there is no way in Pyrex of catching C++
> exceptions from a library and (re)raising them as Python exceptions ?

There might be some hacky way of sneaking the necessary
code into the output to create a C++ try-except block,
but there's nothing official at the moment.

The non-hacky way is to write an external C-compatible
wrapper that catches the C++ exception and returns an
error code, which you can then test for in the Pyrex
code and raise a Python exception.

--
Greg



More information about the Pyrex mailing list