Re: [C++-sig] Boost.Python Metaclass

2011-02-15 Thread Ralf W. Grosse-Kunstleve
Hi James, > I browsed through object/class.cpp, and I think using PyType_IsSubtype() > in place of == &class_metatype_object should be sufficient to allow me > to derive metaclasses from Boost.Python.class. Could (or did?) you try it out? Ideally based on the current boost svn trunk. If you

[C++-sig] Boost.Python Metaclass

2011-02-15 Thread James Emerton
Given a C++ class wrapped with Boost.Python: class CPPClass { void test(); } BOOST_PYTHON_MODULE(testmodule) { class_("CPPClass") .def("test", &CPPClass::test) ; } I've created a python subclass and redefined the metaclass: class Meta(CPPClass.__class__): def __new__(cls, name, ba