[C++-sig] copy boost::python::object crashes

sergun gerasimov at mlab.cs.msu.su
Sun Jan 24 10:30:22 CET 2010


Hi Jim,

In my opinion “object y;” is just declaration of global object, not static 
variable of some class (in this case you are right: explicit declaration 
needed, something like: “object MyStaticClass::y;”).

I have changed setY function to:
void setY(PyObject * y1) { y = object(handle<>(y1)); }

and it doesn’t make crash now.
I’m not sure that such code has no problems and very interested to know why 
assignment of one bp::object to another 
is not correct. I suppose bp:object counteres references correctly and the 
original object is killed only on Python.

Sergey.




More information about the Cplusplus-sig mailing list