C++ throw causes abort in extension?

Gordon McMillan gmcm at hypernet.com
Tue Dec 25 07:45:11 EST 2001


Robert Nikander wrote:

[throw / catch in extension aborts Python]

> Well it is something that was added to gcc between 2.95.3 and 3.0.2.
> 
> I just tried compiling my extension with gcc 2.95.3 rather than
> 3.0.2 and exceptions are caught fine.  So it must be something added
> in gcc 3.

Mk4py (the MetaKit wrapper) uses throw / catch. We just recently had to
get rid of all cases where the throw and catch were at the top level. If
the throw is in a called routine and catch in the caller, it works fine. 
But top-level throw / catches stopped working recently (at least with gcc).

AFAIK, the advise about compiling Python with C++ only applies if your
C++ uses static objects. Mk4py doesn't, and we've never heard of anyone
having to recompile Python with C++ to get it working.

-- Gordon
http://www.mcmillan-inc.com/



More information about the Python-list mailing list