[C++-sig] pyste question
Andrew Sutton
asutton at cs.kent.edu
Tue Aug 24 16:33:46 CEST 2004
> I guess one alternative would be to create a subclass with the special
> methods you want, and export that instead of the original class.
i don't think work for me. i'm dealing with a situation where objects can be
instantiated from both python and the c++ library. what i ended up doing was
creating simple C structs to wrap the classes i want and then build the
python classes from C functions (no pyste). works nice.
by the way, somebody should add some documentation warning users not to do
this:
Foo *f = new Foo;
PyObject *ret = Py_None;
if(...) {
ret = object(f).ptr();
}
return ret;
it took me 2 weeks to figure out that the python object was being reclaimed
before it was returned. that ends up in some pretty ugly bugs :)
thanks for the feedback,
andrew sutton
asutton at cs.kent.edu
More information about the Cplusplus-sig
mailing list