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 639952 - GLib.Variant.new_variant() created objects cause segfaults with each operation
GLib.Variant.new_variant() created objects cause segfaults with each operation
Product: pygobject
Classification: Bindings
Component: introspection
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on: 647796
Reported: 2011-01-19 14:48 UTC by Martin Pitt
Modified: 2011-04-15 14:04 UTC
See Also:
GNOME target: ---
GNOME version: ---

stack trace (11.40 KB, application/octet-stream)
2011-01-19 14:48 UTC, Martin Pitt

Description Martin Pitt 2011-01-19 14:48:38 UTC
Created attachment 178728 [details]
stack trace

I can create a variant containing a variant just fine, but trying to call any method on it just segfaults:

$ gdb --args python -c 'from gi.repository import GLib; v=GLib.Variant.new_variant(GLib.Variant.new_int32(-42)); print v.get_type_string()'

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff58d72f4 in g_variant_type_info_check (info=0x0, container_class=0 '\000')
    at gvarianttypeinfo.c:164
164	  g_assert (info->alignment == 0 || info->alignment == 1 ||

  • #0 g_variant_type_info_check
    at gvarianttypeinfo.c line 164
  • #1 g_variant_type_info_get_type_string
    at gvarianttypeinfo.c line 200
  • #2 g_variant_get_type_string
    at gvariant.c line 1730

As the full stack trace is quite large, I'll attach it.

This is with glib, pygobject, and gobject-introspection git master as of today.
Comment 1 Martin Pitt 2011-01-19 14:51:35 UTC
Interestingly it does work with the variant builder:

$ python
>>> from gi.repository import GLib
>>> i = GLib.Variant.new_int32(-42)
>>> builder = GLib.VariantBuilder()
>>> import gi
>>> builder.init(gi._gi.variant_type_from_string('v'))
>>> builder.add_value(i)
>>> v=builder.end()
>>> v
>>> v.get_type_string()
>>> v.get_variant()
Comment 2 Sebastian Pölsterl 2011-04-15 14:04:04 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.