GNOME Bugzilla – Bug 641493
subclass of gobject and introspected interface is broken
Last modified: 2011-02-04 15:50:29 UTC
I have one failing test in libpeas' python support: /extension/python/create-valid: Traceback (most recent call last):
+ Trace 225850
class PropertiesPythonPlugin(gobject.GObject, Introspection.Properties):
cls._setup_vfuncs()
vfunc_info = find_vfunc_info_in_interface(cls.__bases__, vfunc_name[len("do_"):])
vfunc = find_vfunc_info_in_interface(base.__bases__, vfunc_name)
not isinstance(base.__info__, InterfaceInfo):
This is the code: class PropertiesPythonPlugin(gobject.GObject, Introspection.Properties): __gtype_name__ = "PropertiesPythonPlugin" construct_only = gobject.property(type=str, #default="construct-only", flags=(gobject.PARAM_READWRITE | gobject.PARAM_CONSTRUCT_ONLY)) read_only = gobject.property(type=str, #default="read-only", flags=gobject.PARAM_READABLE) write_only = gobject.property(type=str, #default="write-only", flags=(gobject.PARAM_WRITABLE | gobject.PARAM_CONSTRUCT)) readwrite = gobject.property(type=str, #default="readwrite", flags=(gobject.PARAM_READWRITE | gobject.PARAM_CONSTRUCT)) After investigating a bit, the cause of this exception is that gobject.GObject has no __info__ attribute, and the metaclass assumes all the bases have that attribute. It could be fixed by adding a check if the '__info__' attribute exists. This might be breaking all the static bindings subclasses out there.
Created attachment 180081 [details] [review] Fix subclasses of gobject.GObject and an introspected interface An exception was raised because gobject.GObject doesn't have a __info__ class member.
Looks like I was actually misreading the checks. The issue is that Introspection.Properties is an introspected interface but doesn't have the __info__ field. gobject.GObject should not be an issue since it's not an interface so it's ruled out by the issubclass(base, gobject.GInterface) test.
Created attachment 180087 [details] [review] [GI] Fix vfunc search bug when using GInterfaces and a do_* method. If a class inherits from a GInterface, as well as implements a do_* method (which is not in a super class), all the base interfaces will be searched for an __info__ attribute. GInterface doesn't have one, causing an error on class creation.
Fixed in master. Thanks!