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 684059 - Fails if a property has a boxed type which happens to be a GLib.List
Fails if a property has a boxed type which happens to be a GLib.List
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-15 01:40 UTC by Olivier Crête
Modified: 2013-01-14 08:18 UTC
See Also:
GNOME target: ---
GNOME version: 3.5/3.6


Attachments
pygi-property: Allow for GSList/GList to be declared as Boxed types (1.50 KB, patch)
2012-09-15 01:40 UTC, Olivier Crête
committed Details | Review

Description Olivier Crête 2012-09-15 01:40:14 UTC
Created attachment 224377 [details] [review]
pygi-property: Allow for GSList/GList to be declared as  Boxed types

Allow a property that has been declared as a GLib.List to be a boxed type.
Comment 1 Martin Pitt 2012-09-17 08:42:20 UTC
We don't have test cases for (normal, not boxed) list properties yet, and this patch has the potential to change existing behaviour (due to the newly introduced G_VALUE_HOLDS_POINTER check). It looks fine, but it would be nice if you could provide some instructions how to reproduce this error.

Thanks!
Comment 2 Martin Pitt 2012-09-17 08:45:31 UTC
Err, I meant test cases for lists with normal (not boxed) items. I figure with "boxed" you meant the list items, not the list itself?
Comment 3 Martin Pitt 2012-09-17 09:02:56 UTC
Nevermind, I know what you mean. A mere GList is not already boxed in glib, so you can't just use them as properties.
Comment 4 Olivier Crête 2012-09-17 17:18:22 UTC
I'm not sure how to easily do an test for this without adding this case to the test suite of gir since the pygi test suite seems to re-use their .h/.c files
Comment 5 Martin Pitt 2012-09-17 20:12:14 UTC
It's fine to add new API to the GIMarshallingTests. I was just wondering if you have some existing code which I could look at, I'm not asking you to write the test cases yourself (if you want to, I won't stop you of course :) )

Thanks!
Comment 6 Olivier Crête 2012-09-18 00:49:18 UTC
The existing code is farstream, look at the "codecs" and "codecs-without-config" properties on the FsSession class.. But it's definitely non-trivial
Comment 7 Olivier Crête 2013-01-12 01:31:50 UTC
ping ?
Comment 8 Martin Pitt 2013-01-14 08:18:00 UTC
I added a boxed GList property to GIMarshallingTests:

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

With this we can reproduce the bug and verify the fix in a test case.

I slightly modified your patch to keep the original behaviour of triggering an assertion if the GValue does not hold a boxed or pointer type. With the original patch, arg.v_pointer would just not be set at all without an error. I also included the test case:

http://git.gnome.org/browse/pygobject/commit/?id=0c496d230fee7fd3ada90ee9af10e0bc1e29ee12

This does not yet fix specifying such a property as a constructor argument (for construct-only properties); supporting this is apparently more involved (I didn't manage to fix that quickly), so I just added an exfail test case for this.

Thanks!