GNOME Bugzilla – Bug 616849
Confusing error message with abstract parent class
Last modified: 2010-05-24 17:10:02 UTC
TpBaseConnectionManager is an abstract class. from gi.repository import TelepathyGLib as tpglib class Foo(tpglib.BaseConnectionManager): pass TypeError: cannot create instance of abstract (non-instantiable) type `TpBaseConnectionManager' from gi.repository import TelepathyGLib as tpglib class Foo(tpglib.BaseConnectionManager): __gtype_name__ = 'Foo' as Tomeu suggested, works.
Created attachment 159612 [details] [review] Improve handling of subclasses without __gtype_name__
Created attachment 160325 [details] [review] Improve handling of subclasses without __gtype_name__ Rebased.
The above patch would also fix the crash in bug 619245.
Review of attachment 160325 [details] [review]: ::: tests/test_gi.py @@ +1489,3 @@ + def define_implementor_without_gtype(): + class TestInterfaceImpl(gobject.GObject, GIMarshallingTests.Interface): + def __init__(self): You are missing a "import gobject" here, as the gobject module is not imported globally in this file.
Created attachment 161729 [details] [review] Improve handling of subclasses without __gtype_name__
Review of attachment 161729 [details] [review]: ::: tests/test_gi.py @@ +13,3 @@ sys.path.insert(0, "../") +import gobject TestPythonGObject.test_dynamic_module imports gobject as well so maybe you should remove it there if you import it globally.
Created attachment 161881 [details] [review] Improve handling of subclasses without __gtype_name__ Gives a better message at type registration.
Review of attachment 161881 [details] [review]: Nice. I like the error message.
Attachment 161881 [details] pushed as 1561d29 - Improve handling of subclasses without __gtype_name__