Simon Wood wrote:
> I am in the process of wrapping a C++ class using
Boost.Python. Things
> are progressing well, however the underlying C++
library uses assert()
> for various error checks. Out of curiousity I
triggerred one of the
> asserts() on an exported C++ function from within
Python. Sure enough
> the assertion error printed ( o.k.) AND the Python
interpreter quit (not
> o.k.).
>
> So, is there a way to implement some Python code to
capture the
> underlying C++ assertions, or do I have to modify the
underlying library
> code?
The latter. An assertion is just that. It asserts a certain
statement
to be true, else aborts the running process. (If an
assertion is false
your program is likely to be in an invalid state, so there
is no point
continuing.)
If you want something else you may consider throwing an
exception.
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
C++-sig mailing list
C++-sig python.org
http:
//mail.python.org/mailman/listinfo/c++-sig
|