Hello everybody

I have a problem in a boost.python module that makes use of the boost.regex library. I'm not sure how much the problem is related to those two libraries or whether I'm just doing something wrong in the build setup.

I have the following two python modules:

*** test2.cpp ***
#include <string>

#include<boost/python.hpp>
#include<boost/regex.hpp>

using namespace boost;
using namespace boost::python;

void test_func(std::string const & in)
{
    boost::regex expr("^(.*)\\[.*\\]$");
    boost::match_results<std::string::const_iterator> match;
    boost::regex_match(in.begin(), in.end(), match, expr);
}

BOOST_PYTHON_MODULE(test2)
{
     def("testFunc", &test_func);
}


*** Build command ***
g++-3.4 -Wall -pthread -fPIC -I. -I/usr/include/python2.3 -c -otest2.os test2.cpp
g++-3.4 -pthread -shared -o test2.so test2.os -lpython2.3 -lboost_python-gcc-mt-1_33 -lboost_regex-gcc-mt-1_33


*** test.py ***

from test2 import *
testFunc('justastring')


*** output ***

>>> from test2 import *
>>> testFunc('justastring')
Segmentation fault


The program aborts when exiting test_func(), during deallocation of match_results. The error occurs somewhere in _M_deallocate of stl_vector.h.

Can anybody help me with this problem? What could possibly go wrong here?

One thing I noted: python is compiled using GCC3.3 on our system, while we are using GCC3.4, is this a problem? (But, trying the same on a system with GCC 4 for both, python and our app, also fails, so it seems like the problem is to be sought elsewhere).

Thanks a lot!
Bernhard