I have a problem with storing reference to Python object inside C++.

The following Boost.Python wrapping class:



#include <boost/python.hpp>

using namespace boost;
using namespace boost::python;

namespace cmodule
{

object y;

void setY(object y1) { y = y1; }

}

using namespace cmodule;

BOOST_PYTHON_MODULE(cmodule)
{
        def("setY",setY);
}




Crashes with “Segmentation fault” on so simple python fragment.




import cmodule

class Foo:
    pass

cmodule.setY(Foo())




When I comment “y = y1;” assignment everything is fine.

What I’m doing wrong?

Python version: 2.6
Boost version: 1.41
OS: FreeBSD 8.0

Sergey Gerasimov.


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

Reply via email to