If one is willing to use templated functions, I actually have this working. I omit the definitions of the methods. Note that r_dealloc is not defined any more; the appropriate default is supplied that does the PyMem_DEL. typedef struct { PyObject_HEAD ... data ... } r; r * r_new(...appropriate args...) { // no more remembering how to call PyObject_NEW... r *robj = constructor<r>(); ... set the data members... } ...defn's of methods same as before... ...but rtype not defined as a static static void init_rtype () { PythonType<r>& rtype = type_object<r> (); rtype.name("r"); rtype.doc("r objects: blah,blah"); rtype.repr(r_repr); rtype.sequence_length(r_length); rtype.item(r_item); } _______________ C++-SIG - SIG for Development of a C++ Binding to Python send messages to: c++-sig@python.org administrivia to: c++-sig-request@python.org _______________
participants (1)
-
Paul F. Dubois