GNOME Bugzilla – Bug 631631
add a way to check parameters based on the C base type rather than the override
Last modified: 2010-11-04 20:25:10 UTC
* when overrides override base classes that have themselves been overridden we end up with an inheritance issue * since the class can not inherit from both the C class and the overridden python class we need to be able to check the base C class against parameters when calling methods of the base C class. * currently we check IsInstance against the value of pytype of the registered g_type, which is replaced by the overriden python class * this patch adds a __overridden_pytype__ field to the override python class and stuffs it with the C pytype class * we also add a _pygi_base_type_get_from_g_type call which calls _pygi_type_get_from_g_type and checks the results for __overridden_pytype__ * _pygi_g_registered_type_info_check_object uses this method to avoid comparing the parameter with an override * an example of where we need this is all the subtypes for Gtk.Dialog - e.g. Gtk.MessageDialog, Gtk.AboutDialog, etc.
Created attachment 171913 [details] [review] add a way to check parameters based on the C base type rather than the override
*** Bug 633347 has been marked as a duplicate of this bug. ***
I don't think this is needed anymore. You can get around it in overrides by overriding like this: class TreeStore(Gtk.TreeStore, TreeModel): Note the TreeModel override. That is because Gtk.TreeStore implements Gtk.TreeModel but we have already overridden Gtk.TreeModel. The TreeModel we are overriding here is actually the overridden python class, not Gtk.TreeModel. This ensures the checks work and we do inheritance correctly in the overrides. If we were to fix it with this patch it would enable us to inherit incorrectly. That is not to say this patch may not be needed for other issues but right now I don't think it is needed.
This patch is superseded by patch in 633347
*** This bug has been marked as a duplicate of bug 633347 ***