After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 616849 - Confusing error message with abstract parent class
Confusing error message with abstract parent class
Status: RESOLVED FIXED
Product: pygi
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: 0.6
Assigned To: pygi-maint
pygi-maint
Depends on:
Blocks:
 
 
Reported: 2010-04-26 14:16 UTC by Jonny Lamb
Modified: 2010-05-24 17:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Improve handling of subclasses without __gtype_name__ (2.05 KB, patch)
2010-04-26 15:06 UTC, Tomeu Vizoso
none Details | Review
Improve handling of subclasses without __gtype_name__ (2.05 KB, patch)
2010-05-05 09:03 UTC, Tomeu Vizoso
none Details | Review
Improve handling of subclasses without __gtype_name__ (2.21 KB, patch)
2010-05-22 17:00 UTC, Tomeu Vizoso
none Details | Review
Improve handling of subclasses without __gtype_name__ (2.66 KB, patch)
2010-05-24 16:48 UTC, Tomeu Vizoso
committed Details | Review

Description Jonny Lamb 2010-04-26 14:16:52 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.
Comment 1 Tomeu Vizoso 2010-04-26 15:06:21 UTC
Created attachment 159612 [details] [review]
Improve handling of subclasses without __gtype_name__
Comment 2 Tomeu Vizoso 2010-05-05 09:03:50 UTC
Created attachment 160325 [details] [review]
Improve handling of subclasses without __gtype_name__

Rebased.
Comment 3 Steve Frécinaux 2010-05-21 13:11:48 UTC
The above patch would also fix the crash in bug 619245.
Comment 4 Steve Frécinaux 2010-05-21 17:15:31 UTC
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.
Comment 5 Tomeu Vizoso 2010-05-22 17:00:22 UTC
Created attachment 161729 [details] [review]
Improve handling of subclasses without __gtype_name__
Comment 6 Steve Frécinaux 2010-05-22 17:27:25 UTC
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.
Comment 7 Tomeu Vizoso 2010-05-24 16:48:49 UTC
Created attachment 161881 [details] [review]
Improve handling of subclasses without __gtype_name__

Gives a better message at type registration.
Comment 8 johnp 2010-05-24 17:01:38 UTC
Review of attachment 161881 [details] [review]:

Nice.  I like the error message.
Comment 9 Tomeu Vizoso 2010-05-24 17:09:56 UTC
Attachment 161881 [details] pushed as 1561d29 - Improve handling of subclasses without __gtype_name__