GNOME Bugzilla – Bug 603036
Subclasses with the same name as their parent are not initialized correctly
Last modified: 2009-11-27 21:19:59 UTC
A solution may be checking the gtype instead. Cannot think about a good test case. Suggestions welcome.
Created attachment 148521 [details] [review] Subclasses with the same name as their parent are not initialized correctly
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?
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 ;-)
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.
Review of attachment 148563 [details] [review]: This looks great!
Review of attachment 148563 [details] [review]: Committed as 076ba315.