summaryrefslogtreecommitdiff
path: root/tests/test_overrides_glib.py
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2014-08-21 14:37:14 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2014-08-21 14:37:14 -0700
commitc1d387540a0b2db66e860c574b070051a5431914 (patch)
tree90cedac4fd1b93e42597dacf22336710ff8120b5 /tests/test_overrides_glib.py
parent9ce261f27742ba200f70003f162291a375d244d3 (diff)
downloadpygobject-c1d387540a0b2db66e860c574b070051a5431914.tar.gz
Fix reference counting problems with GLib.Variant.new_tuple()
Always sink the results of g_variant_new_tuple() in the statically bound wrapper. This matches the generic GI marshalling behavior of passing GVariants to Python with transfer-none. https://bugzilla.gnome.org/show_bug.cgi?id=735166
Diffstat (limited to 'tests/test_overrides_glib.py')
-rw-r--r--tests/test_overrides_glib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_overrides_glib.py b/tests/test_overrides_glib.py
index 4d7e63a1..af688952 100644
--- a/tests/test_overrides_glib.py
+++ b/tests/test_overrides_glib.py
@@ -1,6 +1,7 @@
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
+import gc
import unittest
import gi
@@ -61,6 +62,12 @@ class TestGVariant(unittest.TestCase):
self.assertEqual(variant.get_type_string(), '((si)(ub))')
self.assertEqual(variant.unpack(), (('hello', -1), (_long(42), True)))
+ def test_new_tuple_sink(self):
+ # https://bugzilla.gnome.org/show_bug.cgi?id=735166
+ variant = GLib.Variant.new_tuple(GLib.Variant.new_tuple())
+ del variant
+ gc.collect()
+
def test_create_dictionary(self):
variant = GLib.Variant('a{si}', {})
self.assertTrue(isinstance(variant, GLib.Variant))