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 631631 - add a way to check parameters based on the C base type rather than the override
add a way to check parameters based on the C base type rather than the override
Status: RESOLVED DUPLICATE of bug 633347
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-10-07 18:19 UTC by johnp
Modified: 2010-11-04 20:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add a way to check parameters based on the C base type rather than the override (3.23 KB, patch)
2010-10-07 18:19 UTC, johnp
none Details | Review

Description johnp 2010-10-07 18:19:12 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.
Comment 1 johnp 2010-10-07 18:19:14 UTC
Created attachment 171913 [details] [review]
add a way to check parameters based on the C base type rather than the override
Comment 2 Sebastian Pölsterl 2010-10-31 11:13:43 UTC
*** Bug 633347 has been marked as a duplicate of this bug. ***
Comment 3 johnp 2010-11-02 15:53:47 UTC
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.
Comment 4 johnp 2010-11-04 20:21:58 UTC
This patch is superseded by patch in 633347
Comment 5 johnp 2010-11-04 20:22:31 UTC
*** Bug 633347 has been marked as a duplicate of this bug. ***
Comment 6 johnp 2010-11-04 20:25:10 UTC

*** This bug has been marked as a duplicate of bug 633347 ***