C++ throw causes abort in extension?

Robert Nikander nikander at mindspring.nospamcom
Mon Dec 24 12:35:19 EST 2001


Hi everyone,
I am trying to use C++ in my Python extension, but any throwing of
exceptions cause the program to 'abort.'

I put this code in my init module function; and below you see what happens
when I try to import...

  cout << "about to throw in initrobs" << endl; 
  try {
    throw 100;
  }
  catch (...) {
    cout << "Caught ..." << endl;
  }

Python 2.2c1 (#1, Dec 18 2001, 11:04:07) [GCC 3.0.2] on linux2 Type
"help", "copyright", "credits" or "license" for more information.
>>> import robs
about to throw in initrobs
Aborted
[rob at ibooker py_ext2]$

I tested exceptions apart from Python and they are working fine on my system
normally.  So is there something wrong with throwning an exception when
your C++ code was called by C code?  I also tried downloading CXX and it
aborts foir the same reasons, so maybe this is something with GCC 3.02?

Thanks for any help,
Rob



More information about the Python-list mailing list