[C++-sig] boost.python metaclass problem

Stefan Seefeld seefeld at sympatico.ca
Thu Mar 1 23:54:32 CET 2007


Tim Blechmann wrote:
> hi all,
> 
> i've got a problem with a python class, that i'm deriving from two
> classes. one of the base classes is a class from pyqt, the other one is
> a wrapped boost.python class.
> 
> now, when deriving my class from these two classes, i'm getting the
> message:
> TypeError: Error when calling the metaclass bases metaclass conflict:
> the metaclass of a derived class must be a (non-strict) subclass of the
> metaclasses of all its bases  
> 
> any idea, how to solve the metaclass conflict? my boost.python class has
> the structure:
> class_<my_wrapper, boost::noncopyable>("my_class")
>     .def("my_fun", &my_wrapper::my_fun);

The problem you are facing is that there are certain constraints on
the metaclasses of your (multiple) base classes:

http://www.python.org/download/releases/2.2/descrintro/#metaclasses

I don't know pyqt, and I'm not sure you get access to boost.python's
own metaclass. (David ?) You may need to derive a new metaclass from
boost.python's one as well as the pyqt metaclass.

HTH,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list