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 756364 - [REGRESSION] Gdk.rectangle_intersect is not present anymore with pygobject
[REGRESSION] Gdk.rectangle_intersect is not present anymore with pygobject
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-10 22:46 UTC by Thibault Saunier
Modified: 2015-10-24 16:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix Gdk.rectangle_intersect/rectangle_union missing with GTK+ 3.18 (1.92 KB, patch)
2015-10-10 23:33 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Thibault Saunier 2015-10-10 22:46:16 UTC
Trying pitivi with PyGObject I can notice that the Gdk.rectangle_intersect is not exposed anymore but used to be. In the .gir file the symbol is obiously still there and has not been set as 'introspectable=false' so should still be exposed in the API.

You can simply reproduce with:

python3 -c "from gi.repository import Gdk; import gi; print(Gdk.rectangle_intersect); print(gi.version_info)"
sys:1: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
Traceback (most recent call last):
  • File "<string>", line 1 in <module>
  • File "/usr/lib/python3.5/site-packages/gi/overrides/__init__.py", line 39 in __getattr__
    return getattr(self._introspection_module, name)
  • File "/usr/lib/python3.5/site-packages/gi/module.py", line 137 in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.Gdk' object has no attribute 'rectangle_intersect'

Comment 1 Christoph Reiter (lazka) 2015-10-10 23:01:06 UTC
rectangle_intersect is no longer in the gir, it's now an intersect method on the Rectangle type.

Probably the same cause as bug 749625, GdkRectangle was added to the gir in 3.18 so some functions are now methods.

These functions are affected:

gdk_rectangle_get_type (can be ignored imo)
gdk_rectangle_intersect
gdk_rectangle_union

I guess we can add aliases in the override for them.
Comment 2 Thibault Saunier 2015-10-10 23:20:52 UTC
I think aliases should be added to keep API compatibilty. I will port to Gdk.Rectanle.intersect though.
Comment 3 Thibault Saunier 2015-10-10 23:23:52 UTC
Actually I can not port keeping backward compatibility, please add aliases :)
Comment 4 Christoph Reiter (lazka) 2015-10-10 23:33:12 UTC
Created attachment 313035 [details] [review]
Fix Gdk.rectangle_intersect/rectangle_union missing with GTK+ 3.18

3.18 added a Gdk.Rectangle type which changed these functions
to methods in the gir.

Fix by providing aliases in the Gdk overrides.
Comment 5 Thibault Saunier 2015-10-11 10:34:08 UTC
Thanks for that :)

fmpov they broke the API in Gtk and they should have to somehow maintain API compatibilitie in the gir file themselves instead of needing each GI binding implementation to keep track and write overrides.
Comment 6 Christoph Reiter (lazka) 2015-10-11 11:17:49 UTC
(In reply to Thibault Saunier from comment #5)
> fmpov they broke the API in Gtk and they should have to somehow maintain API
> compatibilitie in the gir file themselves instead of needing each GI binding
> implementation to keep track and write overrides.

Yeah. gir doesn't make providing compatible things easy afaik.

Pushed: https://git.gnome.org/browse/pygobject/commit/?id=dfa3a85290dd97ecd7cbe8f12fbc1ff2db5a1155
Comment 7 Thibault Saunier 2015-10-11 11:19:59 UTC
I wonder if you could not detect seach breakage easily in your documentation tool? (and report *upstream* so that they get it fixed where it should be fixed)
Comment 8 Christoph Reiter (lazka) 2015-10-11 11:42:20 UTC
(In reply to Thibault Saunier from comment #7)
> I wonder if you could not detect seach breakage easily in your documentation
> tool? (and report *upstream* so that they get it fixed where it should be
> fixed)

There is some work by Philip Withnall comparing gir files: https://git.gnome.org/browse/gobject-introspection/log/?h=wip/api-diff

And I've created something similar in pgi comparing typelibs, but it's not finished: https://github.com/lazka/pgi/blob/master/examples/tdump.py
Comment 9 Thibault Saunier 2015-10-23 15:34:42 UTC
Could you please cherry pick that commit and make a release?
Comment 10 Thibault Saunier 2015-10-23 15:36:22 UTC
(In reply to Thibault Saunier from comment #9)
> Could you please cherry pick that commit and make a release?

I should have checked before commiting, it has been cherry-picked https://git.gnome.org/browse/pygobject/commit/?h=pygobject-3-18&id=8e7f6f1458cf1c162c13422c72562b00433b762b -- just waiting the 3.18.1 release then :)
Comment 11 Christoph Reiter (lazka) 2015-10-24 16:32:27 UTC
3.18.1 release is out