Bug#1117897: pygobject FTBFS with Python 3.14: TestReferences AssertionErrors

Stefano Rivera stefanor at debian.org
Sun Oct 12 10:24:48 BST 2025


Source: pygobject
Version: 3.50.0-7
Severity: normal
Tags: ftbfs patch upstream
User: debian-python at lists.debian.org
Usertags: python3.14
Forwarded: https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/433

Python 3.14 is upon us, and we would like to enable it as a supported 
version in Debian.

pygobject fails to build with Python 3.14 as an available version. 
Graham Inggs did a test rebuild in Ubuntu and found this build failure. 
These can be reproduced in Debian by installing python3-all from 
experimental (but you may need to rebuild some dependencies by hand, 
first).

I think it has been fixed in a new upstream version, but that needs to 
be checked. At least this MR looks like it should resolve the issue:
https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/433

Build log: https://launchpadlibrarian.net/823264865/buildlog_ubuntu-questing-amd64.pygobject_3.50.0-7build1_BUILDING.txt.gz

Errors:

=================================== FAILURES ===================================
______________________ TestReferences.test_iteration_refs ______________________

self = <tests.test_generictreemodel.TestReferences testMethod=test_iteration_refs>

    def test_iteration_refs(self):
        # Pull iterators off the model using the wrapped C API which will
        # then call back into the python overrides.
        model = ATesterModel()
        nodes = [node for node in model.iter_depth_first()]
        values = [node.value for node in nodes]
    
        # Verify depth first ordering
        self.assertEqual(values, [0, 1, 2, 3, 4])
    
        # Verify ref counts for each of the nodes.
        # 5 refs for each node at this point:
        #   1 - ref held in getrefcount function
        #   2 - ref held by "node" var during iteration
        #   3 - ref held by local "nodes" var
        #   4 - ref held by the root/children graph itself
        #   5 - ref held by the model "held_refs" instance var
        for node in nodes:
            if hasattr(sys, "getrefcount"):
>               self.assertEqual(sys.getrefcount(node), 5)
E               AssertionError: 4 != 5

tests/test_generictreemodel.py:258: AssertionError
__________ TestPythonReferenceCounting.test_new_instance_has_two_refs __________

self = <tests.test_gobject.TestPythonReferenceCounting testMethod=test_new_instance_has_two_refs>

    def test_new_instance_has_two_refs(self):
        obj = GObject.GObject()
        if hasattr(sys, "getrefcount"):
>           self.assertEqual(sys.getrefcount(obj), 2)
E           AssertionError: 1 != 2

tests/test_gobject.py:317: AssertionError
_ TestPythonReferenceCounting.test_new_instance_has_two_refs_using_gobject_new _

self = <tests.test_gobject.TestPythonReferenceCounting testMethod=test_new_instance_has_two_refs_using_gobject_new>

    def test_new_instance_has_two_refs_using_gobject_new(self):
        obj = GObject.new(GObject.GObject)
        if hasattr(sys, "getrefcount"):
>           self.assertEqual(sys.getrefcount(obj), 2)
E           AssertionError: 1 != 2

tests/test_gobject.py:322: AssertionError
_____ TestPythonReferenceCounting.test_new_subclass_instance_has_two_refs ______

self = <tests.test_gobject.TestPythonReferenceCounting testMethod=test_new_subclass_instance_has_two_refs>

    def test_new_subclass_instance_has_two_refs(self):
        obj = A()
        if hasattr(sys, "getrefcount"):
>           self.assertEqual(sys.getrefcount(obj), 2)
E           AssertionError: 1 != 2

tests/test_gobject.py:327: AssertionError
_ TestPythonReferenceCounting.test_new_subclass_instance_has_two_refs_using_gobject_new _

self = <tests.test_gobject.TestPythonReferenceCounting testMethod=test_new_subclass_instance_has_two_refs_using_gobject_new>

    def test_new_subclass_instance_has_two_refs_using_gobject_new(self):
        obj = GObject.new(A)
        if hasattr(sys, "getrefcount"):
>           self.assertEqual(sys.getrefcount(obj), 2)
E           AssertionError: 1 != 2

tests/test_gobject.py:332: AssertionError
____________ TestVFuncsWithObjectArg.test_vfunc_self_arg_ref_count _____________

self = <tests.test_object_marshaling.TestVFuncsWithObjectArg testMethod=test_vfunc_self_arg_ref_count>

    def test_vfunc_self_arg_ref_count(self):
        # Check to make sure vfunc "self" arguments don't leak.
        vfuncs = self.VFuncs()
        vfuncs_ref = weakref.ref(vfuncs)
        vfuncs.get_ref_info_for_vfunc_return_object_transfer_full()  # Use any vfunc to test this.
    
        gc.collect()
        if hasattr(sys, "getrefcount"):
>           self.assertEqual(sys.getrefcount(vfuncs), 2)
E           AssertionError: 1 != 2

tests/test_object_marshaling.py:112: AssertionError
_____________ TestCPropsAccessor.test_held_object_ref_count_setter _____________

self = <tests.test_properties.TestCPropsAccessor testMethod=test_held_object_ref_count_setter>

    def test_held_object_ref_count_setter(self):
        holder = GIMarshallingTests.PropertiesObject()
        held = GObject.Object()
    
        self.assertEqual(holder.__grefcount__, 1)
        self.assertEqual(held.__grefcount__, 1)
    
        # Setting property should only increase ref count by 1
        self.set_prop(holder, 'some-object', held)
        self.assertEqual(holder.__grefcount__, 1)
>       self.assertEqual(held.__grefcount__, 2)
E       AssertionError: 3 != 2

tests/test_properties.py:1312: AssertionError
___________ TestRefCountsNonIntrospected.test_callback_ref_count_del ___________

self = <tests.test_signal.TestRefCountsNonIntrospected testMethod=test_callback_ref_count_del>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_callback_ref_count_del(self):
        def callback(obj, value):
            return value // 2
    
        callback_ref = weakref.ref(callback)
>       self.assertEqual(sys.getrefcount(callback), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1418: AssertionError
_______ TestRefCountsNonIntrospected.test_callback_ref_count_disconnect ________

self = <tests.test_signal.TestRefCountsNonIntrospected testMethod=test_callback_ref_count_disconnect>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_callback_ref_count_disconnect(self):
        def callback(obj, value):
            return value // 2
    
        callback_ref = weakref.ref(callback)
>       self.assertEqual(sys.getrefcount(callback), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1440: AssertionError
___ TestRefCountsNonIntrospected.test_callback_ref_count_disconnect_by_func ____

self = <tests.test_signal.TestRefCountsNonIntrospected testMethod=test_callback_ref_count_disconnect_by_func>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_callback_ref_count_disconnect_by_func(self):
        def callback(obj, value):
            return value // 2
    
        callback_ref = weakref.ref(callback)
>       self.assertEqual(sys.getrefcount(callback), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1462: AssertionError
____________ TestRefCountsNonIntrospected.test_user_data_ref_count _____________

self = <tests.test_signal.TestRefCountsNonIntrospected testMethod=test_user_data_ref_count>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_user_data_ref_count(self):
        def callback(obj, value, data):
            return value // 2
    
        data = self.PyData()
        data_ref = weakref.ref(data)
>       self.assertEqual(sys.getrefcount(data), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1485: AssertionError
____________ TestRefCountsIntrospected.test_callback_ref_count_del _____________

self = <tests.test_signal.TestRefCountsIntrospected testMethod=test_callback_ref_count_del>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_callback_ref_count_del(self):
        def callback(obj, value):
            return value // 2
    
        callback_ref = weakref.ref(callback)
>       self.assertEqual(sys.getrefcount(callback), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1418: AssertionError
_________ TestRefCountsIntrospected.test_callback_ref_count_disconnect _________

self = <tests.test_signal.TestRefCountsIntrospected testMethod=test_callback_ref_count_disconnect>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_callback_ref_count_disconnect(self):
        def callback(obj, value):
            return value // 2
    
        callback_ref = weakref.ref(callback)
>       self.assertEqual(sys.getrefcount(callback), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1440: AssertionError
_____ TestRefCountsIntrospected.test_callback_ref_count_disconnect_by_func _____

self = <tests.test_signal.TestRefCountsIntrospected testMethod=test_callback_ref_count_disconnect_by_func>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_callback_ref_count_disconnect_by_func(self):
        def callback(obj, value):
            return value // 2
    
        callback_ref = weakref.ref(callback)
>       self.assertEqual(sys.getrefcount(callback), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1462: AssertionError
______________ TestRefCountsIntrospected.test_user_data_ref_count ______________

self = <tests.test_signal.TestRefCountsIntrospected testMethod=test_user_data_ref_count>

    @unittest.skipUnless(hasattr(sys, "getrefcount"), "no sys.getrefcount")
    def test_user_data_ref_count(self):
        def callback(obj, value, data):
            return value // 2
    
        data = self.PyData()
        data_ref = weakref.ref(data)
>       self.assertEqual(sys.getrefcount(data), 2)
E       AssertionError: 1 != 2

tests/test_signal.py:1485: AssertionError



More information about the pkg-gnome-maintainers mailing list