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 738422 - GKeyFile giving unexpected function call return
GKeyFile giving unexpected function call return
Status: RESOLVED OBSOLETE
Product: pygobject
Classification: Bindings
Component: introspection
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-12 22:28 UTC by Christian Fredrik Kalager Schaller
Modified: 2018-01-10 20:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
simple python test app (1.72 KB, text/x-python)
2014-10-12 22:28 UTC, Christian Fredrik Kalager Schaller
Details
test keyfile (195 bytes, application/octet-stream)
2014-10-12 22:29 UTC, Christian Fredrik Kalager Schaller
Details

Description Christian Fredrik Kalager Schaller 2014-10-12 22:28:59 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.
Comment 1 Christian Fredrik Kalager Schaller 2014-10-12 22:29:20 UTC
Created attachment 288356 [details]
test keyfile
Comment 2 Simon Feltman 2014-10-18 02:53:12 UTC
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
Comment 3 GNOME Infrastructure Team 2018-01-10 20:47:37 UTC
-- 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.