Boost logo

Boost :

From: Andreas Dietrich (quasi_at_[hidden])
Date: 2001-08-16 18:25:33


Hi.

The following code results in a segfault when calling test from python:

#include <Python.h>

namespace {

   PyObject *test(int l,int h){
      // not reached
      return 0;
   }
}
#include <boost/python/class_builder.hpp>
namespace python = boost::python;
BOOST_PYTHON_MODULE_INIT(crash) {
  try {
    python::module_builder this_module("crash");
    this_module.def(test,"test");
  }
  catch(...) {
    python::handle_exception();
  }
}

My setup:

Linux/i386

$ g++-2.96 -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs
gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.58mdk)

I tried python 2.0, 2.1 each with and without exceptions enabled when
compiling bpl and crash.cpp. All with the same result, import crash works
fine, crash.test(1,1) segfaults.

Can anybody help me? I tried to look at it in a debugger, but I don't even
begin to understand the magic inside of boost::python :-(

Andreas

-- 
"We've heard that a million monkeys at a million keyboards could produce the
complete works of Shakespeare. Now, thanks to the Internet, we know this is not
true."  -- Robert Wilensky

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk