GNOME Bugzilla – Bug 684059
Fails if a property has a boxed type which happens to be a GLib.List
Last modified: 2013-01-14 08:18:10 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.
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!
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?
Nevermind, I know what you mean. A mere GList is not already boxed in glib, so you can't just use them as properties.
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
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!
The existing code is farstream, look at the "codecs" and "codecs-without-config" properties on the FsSession class.. But it's definitely non-trivial
ping ?
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!