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 677249 - gi: Fix boxed type equality
gi: Fix boxed type equality
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-01 07:28 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-06-01 13:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gi: Fix boxed type equality (1.96 KB, patch)
2012-06-01 07:28 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
tests: Add a refcounting boxed (3.49 KB, patch)
2012-06-01 07:29 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-06-01 07:28:31 UTC
Any two boxed wrappers with the same pointer (ref'd boxed types are
quite common) won't equal each other, because we don't test for the
boxed type correctly.

If the two boxed wrappers are the same, it evaluates to True, but will
still test to False in this path, leading Python to fall back to the
default "a is b" test.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-06-01 07:28:33 UTC
Created attachment 215391 [details] [review]
gi: Fix boxed type equality

Each boxed type has its own Python type, not PyGBoxed_Type. Use
PyObject_IsInstance instead of comparing against PyGBoxed_Type directly.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-06-01 07:29:18 UTC
Created attachment 215392 [details] [review]
tests: Add a refcounting boxed

The gobject-introspection tests side of the patch. I'm surprised that
we haven't yet had a refcounting struct in libregress.
Comment 3 Martin Pitt 2012-06-01 13:49:29 UTC
Thanks a lot for this! Both pushed.