GNOME Bugzilla – Bug 687550
gi struct array length annotations are not used with array fields
Last modified: 2012-11-20 10:59:38 UTC
Currently when accessing the "param_types" field of a GSignalQuery struct we get back an invalid GType: $ python3 -c "import gi.module; print(gi.module.get_introspection_module('GObject').signal_query(1).param_types)" <GType invalid (28749744)> When looking into a fix, bug 687545 and bug 687541 were found. I was able to manually add the proper annotation to the GObject gir as noted in bug 687545. Typelibs and the gi api give back the proper info for struct array length fields but more problems were uncovered in pygi. The above python code then gives the following error once the annotation is fixed: ** (process:22252): CRITICAL **: Unable to determine array length for 0x2895d30 Within gi/pygi-info.c:_wrap_g_field_info_get_value there is a special case for handling GI_TYPE_TAG_ARRAY fields. This handling re-uses _pygi_argument_to_array for an array field but it cannot properly handle lookup of an array length of a struct as the function is intended to work with function arguments, not struct fields. _pygi_argument_to_array could copied and specialized for struct fields to fix this.
*** This bug has been marked as a duplicate of bug 678663 ***