GNOME Bugzilla – Bug 738422
GKeyFile giving unexpected function call return
Last modified: 2018-01-10 20:47:37 UTC
Created attachment 288355 [details] simple python test app So I translated a Vala example of how to use GKeyFile to Python. Works fine now, but there was one thing that struck me as weird. The get_groups() and get_keys() call doesn't just return a list of the values, but they also return the lenght of the array. So this is easy enough to deal with as seen below, but I am not sure it is what I would say is my expectation of what I should get back, so I am filing this bug to ask if this might be a bindings bug and that the call should just provide those lists back. lists,groupsarraylenght=file.get_groups() for x in lists: keys,keyarraylenght=file.get_keys(x) Attaching my little sample app and sample keyfile.
Created attachment 288356 [details] test keyfile
If you look at the C docs for g_key_file_get_groups() [1], it notes that the returned array is zero terminated and optionally supports a length output argument. GI seems to be picking up the zero terminated array length and the length arg as an extra out arg. I think it would be a lot cleaner to change the zero terminated annotation to use the length instead. Sadly this would be an API break for any existing users of this API. What we can probably do is move this to GLib and tag as for the next major release (not sure exactly what that tag would be though). [1] https://developer.gnome.org/glib/2.28/glib-Key-value-file-parser.html#g-key-file-get-groups
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pygobject/issues/91.