GNOME Bugzilla – Bug 667194
Fails to marshall NULL as an array return value
Last modified: 2012-01-03 16:43:57 UTC
The following testcase fails: from gi.repository import Gtk, GdkPixbuf, Gdk, GtkSource import os, sys languageManager = GtkSource.LanguageManager() languages = languageManager.get_language_ids() goLanguage = languageManager.get_language('go') print (goLanguage.get_style_ids()); # works chdrLanguage = languageManager.get_language('chdr') print (chdrLanguage.get_style_ids()) # causes "assertion failed: (arg->v_pointer The assertion is due to the fact that get_style_ids returns a gchar** array but it may also return NULL when there are no ids. Pygobject does not handle that. The follwing patches fix the issue and add a testcase that also reproduce the issue. However I am not sure if NULL should be handled as [] like in the patch or if it should be handled ad None. Do we need a special annotation to say that NULL is a valid value?
Created attachment 204503 [details] [review] patch
Created attachment 204504 [details] [review] test g-i part of the testcase
Created attachment 204505 [details] [review] test
Comment on attachment 204503 [details] [review] patch Looks good
Comment on attachment 204504 [details] [review] test Feel free to commit this but make sure make check works for gobject-introspection. I forget which test gir they check (either regress or gimarshalling) but they do a diff just to make sure something hasn't broken in the gi parser.
BTW sequences should always return empty on NULL since GLib treats NULL as empty lists etc.
Thanks for the quick review, I pushed the patches (also the g-i part with Johan's blessing)