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 690514 - pyg_value_from_pyobject: support GArray
pyg_value_from_pyobject: support GArray
Status: RESOLVED FIXED
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: 2012-12-19 18:13 UTC by Ray Strode [halfline]
Modified: 2013-01-07 15:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pyg_value_from_pyobject: support GArray (2.85 KB, patch)
2012-12-19 18:13 UTC, Ray Strode [halfline]
none Details | Review
pyg_value_from_pyobject: support GArray (2.59 KB, patch)
2012-12-19 21:17 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2012-12-19 18:13:08 UTC
This commit adds support for marshalling
a python list (or other sequence) returned
from signal handlers to GArray, if necessary.

This parallels the implementation written
to marshal to (the now deprecated) GValueArray.

This fixes a crash in rhythmbox as seen downstream here:

https://bugzilla.redhat.com/show_bug.cgi?id=872851
Comment 1 Ray Strode [halfline] 2012-12-19 18:13:09 UTC
Created attachment 231917 [details] [review]
pyg_value_from_pyobject: support GArray
Comment 2 Ray Strode [halfline] 2012-12-19 21:11:59 UTC
This causes some test failures, will post an updated patch.
Comment 3 Ray Strode [halfline] 2012-12-19 21:17:32 UTC
Created attachment 231935 [details] [review]
pyg_value_from_pyobject: support GArray

This commit adds support for marshalling
a python list (or other sequence) returned
from signal handlers to GArray, if necessary.

This parallels the implementation written
to marshal to (the now deprecated) GValueArray.

This fixes a crash in rhythmbox as seen downstream here:

https://bugzilla.redhat.com/show_bug.cgi?id=872851
Comment 4 Martin Pitt 2012-12-20 08:59:10 UTC
Thanks for the patch! This looks good, but needs a regression test. Unless someone beats me to it, I'll write one when I'm back from vacation.
Comment 5 Martin Pitt 2013-01-04 08:49:02 UTC
I added a signal that returns a GArray to gobject-introspection's tests:

http://git.gnome.org/browse/gobject-introspection/commit/?id=eff011ce1d274e9add73fbf71fb8617ba37fb9f8

With this we can write a test case, which I added to your commit:

http://git.gnome.org/browse/pygobject/commit/?id=23d1f14f553069740465c82eaa937b877c41e0cb

It looks a bit ugly as this actually returns a GLib.Array object to Python instead of a Python array; that still smells like a bug, but at least we now assert that it returns the expected type to C.

Thanks!
Comment 6 Ray Strode [halfline] 2013-01-07 15:38:08 UTC
Thanks for the work on this.