Boost Python seems to be failing to catch and translate C++ exceptions for me on a BlueGene/P installation. I really don't know what to do next in debugging the problem, so I would appreciate any advice.

I have a simple test module, pyexcept
------------------------------------------------------------
#include <boost/python.hpp>
#include <iostream>
#include <stdexcept>


void
foo()
{
    std::cout << "in foo, about to raise exception\n";
    throw std::runtime_error("runtime_error from foo");
    std::cout << "this should never be seen\n";
}

using namespace boost::python;

BOOST_PYTHON_MODULE(pyexcept)
{
    def("foo",foo);
}
------------------------------------------------------------

I test it with the following python script:
------------------------------------------------------------
#!/usr/bin/env python

import pyexcept

print "about to run pyexcept.foo, catching exception"
try:
    pyexcept.foo()
except RuntimeError,e:
    print "caught RuntimeError,",e
------------------------------------------------------------

On my Linux machine I see:
------------------------------------------------------------
about to run pyexcept.foo, catching exception
in foo, about to raise exception
caught RuntimeError, runtime_error from foo
------------------------------------------------------------

On the BlueGene/P machine I see:
------------------------------------------------------------
about to run pyexcept.foo, catching exception
in foo, about to raise exception
terminate called after throwing an instance of 'std::runtime_error'
  what():  runtime_error from foo
------------------------------------------------------------

I have (cross-)compiled boost myself using the system's installed version of the gnu compilers, 4.1.2:
------------------------------------------------------------
|login2>mpicxx.gnu --version
powerpc-bgp-linux-g++ (GCC) 4.1.2 (BGP)
------------------------------------------------------------

(The mpicxx.gnu script is a wrapper around the cross-compiling g++.) Has anyone seen a problem like this? Any ideas as to how to debug it?

Thanks for any advice.

--Jim Amundson

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to