GLib.VariantType.next broken on PyGObject
While working on #152 (closed) I noticed that GLib.VariantType.next has a really odd behaviour on Python.
This is the expected behaviour from this C snippet:
#include <glib/gi18n.h>
int
main (int argc,
char *argv[])
{
const GVariantType *gv = G_VARIANT_TYPE ("(siv)");
const GVariantType *next = g_variant_type_first (gv);
g_printf ("%s\n", g_variant_type_dup_string (next));
next = g_variant_type_next(next);
g_printf ("%s\n", g_variant_type_dup_string (next));
next = g_variant_type_next(next);
g_printf ("%s\n", g_variant_type_dup_string (next));
return 0;
}
That would output three lines with 's', 'i' and 'v'.
However, this Python snippet:
In [2]: from gi.repository import GLib
In [3]: t = GLib.VariantType("(siv)")
In [4]: f = t.first()
In [5]: f.dup_string()
Out[5]: 's'
In [6]: s = f.next()
In [7]: s.dup_string()
Out[7]: ''
next always returns a new type with an empty string, something odd is happening at the wrapper level (note that first and next just create a pointer to the next position of the format string as GVariantType is an empty struct).