[pygtk] gobject & metaclasses

Alessandro Dentella sandro at e-den.it
Sun Oct 26 18:30:15 WST 2008


I don't really understand the error message I receive when I try to use
gobject & metaclasses as in the following code:

   import gobject

   class Dummy(type):
       def __new__(cls, name, bases, attrs):
	   return type.__new__(cls, name, bases, attrs)


   class A(object):
       __metaclass__ = Dummy    ### works

   class B(gobject.GObject):
       __metaclass__ = Dummy    ### does not work


I get:

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


What does this mean and what should I do instead?


Thanks in advance

sandro


More information about the pygtk mailing list