Python 2.2.1 C API - Error Handling

David Abrahams david.abrahams at
Tue Aug 20 05:23:16 CEST 2002

<cseymour at> wrote in message
news:kvr8gu2x71.fsf at
> The compiler is gcc 3.0.4. We switched from 2.95 to 3.0.4 between 2.1 and

That explains everything.

The GCC 3.x ABI compares typeinfo addressesinstead of typeinfo name strings
to do exception matching, with bad results for code that throws across
shared library boundaries (please complain to the GCC developers about this move -- a very premature
"optimization" IMO).

Have you updated your Boost installation recently?
The current Boost release helps with some workarounds for this problem.

Instead of writing "throw boost::python::argument_error()" you can write
"boost::python::throw_argument_error()" and then the exception will be
thrown in the same shared library where it is eventually rethrown and caught
by boost::python::handle_exception().


P.S. and in future, really do post to; I
don't always watch this newsgroup.

           David Abrahams * Boost Consulting
dave at *

More information about the Python-list mailing list