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 603036 - Subclasses with the same name as their parent are not initialized correctly
Subclasses with the same name as their parent are not initialized correctly
Status: RESOLVED FIXED
Product: pygi
Classification: Deprecated
Component: general
unspecified
Other All
: Normal normal
: 0.6
Assigned To: pygi-maint
pygi-maint
Depends on:
Blocks: 602830
 
 
Reported: 2009-11-26 11:40 UTC by Tomeu Vizoso
Modified: 2009-11-27 21:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Subclasses with the same name as their parent are not initialized correctly (852 bytes, patch)
2009-11-26 11:40 UTC, Tomeu Vizoso
reviewed Details | Review
Fix subclass test in metaclasses (2.58 KB, patch)
2009-11-26 23:03 UTC, Simon van der Linden
committed Details | Review

Description Tomeu Vizoso 2009-11-26 11:40:11 UTC
A solution may be checking the gtype instead. Cannot think about a good test
case. Suggestions welcome.
Comment 1 Tomeu Vizoso 2009-11-26 11:40:14 UTC
Created attachment 148521 [details] [review]
Subclasses with the same name as their parent are not initialized correctly
Comment 2 Simon van der Linden 2009-11-26 22:16:31 UTC
Review of attachment 148521 [details] [review]:

Good idea.

Although this would work for objects, it doesn't apply to structures (even registered ones). Any other idea?
Comment 3 Simon van der Linden 2009-11-26 22:22:36 UTC
If a class wasn't considered a subclass of itself, we could check that the class is a strict subclass of g_type.pytype.

We could still implement a search in the tree of bases ;-)
Comment 4 Simon van der Linden 2009-11-26 23:03:43 UTC
Created attachment 148563 [details] [review]
Fix subclass test in metaclasses

If a GType is available from the info, the fact that it
doesn't have any wrapper yet means that the metaclass is creating the base
class, which will be registerd just after its creation. This is true for
objects, and for structures registered as boxed or pointer too.

This patch includes a test for basic subclassing in Python. It notably tests
that methods don't get overridden by the metaclass.
Comment 5 Tomeu Vizoso 2009-11-27 11:03:30 UTC
Review of attachment 148563 [details] [review]:

This looks great!
Comment 6 Simon van der Linden 2009-11-27 21:19:34 UTC
Review of attachment 148563 [details] [review]:

Committed as 076ba315.