Fedora Account System
Red Hat Associate
Red Hat Customer
pybind11 fails to build with Python 3.13.0b2: 3 tests fail =================================== FAILURES =================================== ___________________________ test_init_factory_alias ____________________________ def test_init_factory_alias(): """Tests py::init_factory() wrapper with value conversions and alias types""" cstats = [m.TestFactory6.get_cstats(), m.TestFactory6.get_alias_cstats()] cstats[0].alive() # force gc n_inst = ConstructorStats.detail_reg_inst() a = m.TestFactory6(tag.base, 1) assert a.get() == 1 assert not a.has_alias() b = m.TestFactory6(tag.alias, "hi there") assert b.get() == 8 assert b.has_alias() c = m.TestFactory6(tag.alias, 3) assert c.get() == 3 assert c.has_alias() d = m.TestFactory6(tag.alias, tag.pointer, 4) assert d.get() == 4 assert d.has_alias() e = m.TestFactory6(tag.base, tag.pointer, 5) assert e.get() == 5 assert not e.has_alias() f = m.TestFactory6(tag.base, tag.alias, tag.pointer, 6) assert f.get() == 6 assert f.has_alias() assert ConstructorStats.detail_reg_inst() == n_inst + 6 assert [i.alive() for i in cstats] == [6, 4] del a, b, e assert [i.alive() for i in cstats] == [3, 3] assert ConstructorStats.detail_reg_inst() == n_inst + 3 del f, c, d assert [i.alive() for i in cstats] == [0, 0] assert ConstructorStats.detail_reg_inst() == n_inst class MyTest(m.TestFactory6): def __init__(self, *args): m.TestFactory6.__init__(self, *args) def get(self): return -5 + m.TestFactory6.get(self) # Return Class by value, moved into new alias: z = MyTest(tag.base, 123) assert z.get() == 118 assert z.has_alias() # Return alias by value, moved into new alias: y = MyTest(tag.alias, "why hello!") assert y.get() == 5 assert y.has_alias() # Return Class by pointer, moved into new alias then original destroyed: x = MyTest(tag.base, tag.pointer, 47) assert x.get() == 42 assert x.has_alias() assert ConstructorStats.detail_reg_inst() == n_inst + 3 assert [i.alive() for i in cstats] == [3, 3] del x, y, z > assert [i.alive() for i in cstats] == [0, 0] E assert [3, 3] == [0, 0] E At index 0 diff: 3 != 0 E Use -v to get more diff MyTest = <class 'test_factory_constructors.test_init_factory_alias.<locals>.MyTest'> cstats = [<pybind11_tests.ConstructorStats object at 0x7f2b9688e970>, <pybind11_tests.ConstructorStats object at 0x7f2b95eeb7f0>] n_inst = 65 ../../tests/test_factory_constructors.py:212: AssertionError ----------------------------- Captured stdout call ----------------------------- ### TestFactory6 @ 0x7ffc197a7cd0 created 1 ### TestFactory6 @ 0x55c4b45c56b0 created via move constructor ### TestFactory6 @ 0x7ffc197a7cd0 destroyed ### TestFactory6 @ 0x7ffc197a7bc0 created 8 ### PyTF6 @ 0x7ffc197a7bc0 created hi there ### TestFactory6 @ 0x55c4b45c5fc0 created via move constructor ### PyTF6 @ 0x55c4b45c5fc0 created via move constructor ### PyTF6 @ 0x7ffc197a7bc0 destroyed ### TestFactory6 @ 0x7ffc197a7bc0 destroyed ### TestFactory6 @ 0x7ffc197a7c80 created 3 ### PyTF6 @ 0x7ffc197a7c80 created 3 ### TestFactory6 @ 0x55c4b45c6250 created via move constructor ### PyTF6 @ 0x55c4b45c6250 created via move constructor ### PyTF6 @ 0x7ffc197a7c80 destroyed ### TestFactory6 @ 0x7ffc197a7c80 destroyed ### TestFactory6 @ 0x55c4b45ab160 created 4 ### PyTF6 @ 0x55c4b45ab160 created 4 ### TestFactory6 @ 0x55c4b45c6990 created 5 ### TestFactory6 @ 0x55c4b45c69d0 created 6 ### PyTF6 @ 0x55c4b45c69d0 created 6 ### TestFactory6 @ 0x55c4b45c56b0 destroyed ### PyTF6 @ 0x55c4b45c5fc0 destroyed ### TestFactory6 @ 0x55c4b45c5fc0 destroyed ### TestFactory6 @ 0x55c4b45c6990 destroyed ### PyTF6 @ 0x55c4b45c69d0 destroyed ### TestFactory6 @ 0x55c4b45c69d0 destroyed ### PyTF6 @ 0x55c4b45c6250 destroyed ### TestFactory6 @ 0x55c4b45c6250 destroyed ### PyTF6 @ 0x55c4b45ab160 destroyed ### TestFactory6 @ 0x55c4b45ab160 destroyed ### TestFactory6 @ 0x7ffc197a7b50 created 123 ### TestFactory6 @ 0x55c4b45c6950 created via move constructor ### PyTF6 @ 0x55c4b45c6950 created move 123 ### TestFactory6 @ 0x7ffc197a7b50 destroyed ### TestFactory6 @ 0x7ffc197a7a40 created 10 ### PyTF6 @ 0x7ffc197a7a40 created why hello! ### TestFactory6 @ 0x55c4b45c6ad0 created via move constructor ### PyTF6 @ 0x55c4b45c6ad0 created via move constructor ### PyTF6 @ 0x7ffc197a7a40 destroyed ### TestFactory6 @ 0x7ffc197a7a40 destroyed ### TestFactory6 @ 0x55c4b45ab6a0 created 47 ### TestFactory6 @ 0x55c4b45c6b90 created via move constructor ### PyTF6 @ 0x55c4b45c6b90 created move 47 ### TestFactory6 @ 0x55c4b45ab6a0 destroyed ____________________________ test_init_factory_dual ____________________________ def test_init_factory_dual(): """Tests init factory functions with dual main/alias factory functions""" from pybind11_tests.factory_constructors import TestFactory7 cstats = [TestFactory7.get_cstats(), TestFactory7.get_alias_cstats()] cstats[0].alive() # force gc n_inst = ConstructorStats.detail_reg_inst() class PythFactory7(TestFactory7): def get(self): return 100 + TestFactory7.get(self) a1 = TestFactory7(1) a2 = PythFactory7(2) assert a1.get() == 1 assert a2.get() == 102 assert not a1.has_alias() assert a2.has_alias() b1 = TestFactory7(tag.pointer, 3) b2 = PythFactory7(tag.pointer, 4) assert b1.get() == 3 assert b2.get() == 104 assert not b1.has_alias() assert b2.has_alias() c1 = TestFactory7(tag.mixed, 5) c2 = PythFactory7(tag.mixed, 6) assert c1.get() == 5 assert c2.get() == 106 assert not c1.has_alias() assert c2.has_alias() d1 = TestFactory7(tag.base, tag.pointer, 7) d2 = PythFactory7(tag.base, tag.pointer, 8) assert d1.get() == 7 assert d2.get() == 108 assert not d1.has_alias() assert d2.has_alias() # Both return an alias; the second multiplies the value by 10: e1 = TestFactory7(tag.alias, tag.pointer, 9) e2 = PythFactory7(tag.alias, tag.pointer, 10) assert e1.get() == 9 assert e2.get() == 200 assert e1.has_alias() assert e2.has_alias() f1 = TestFactory7(tag.shared_ptr, tag.base, 11) f2 = PythFactory7(tag.shared_ptr, tag.base, 12) assert f1.get() == 11 assert f2.get() == 112 assert not f1.has_alias() assert f2.has_alias() g1 = TestFactory7(tag.shared_ptr, tag.invalid_base, 13) assert g1.get() == 13 assert not g1.has_alias() with pytest.raises(TypeError) as excinfo: PythFactory7(tag.shared_ptr, tag.invalid_base, 14) assert ( str(excinfo.value) == "pybind11::init(): construction failed: returned holder-wrapped instance is not an " "alias instance" ) assert [i.alive() for i in cstats] == [13, 7] assert ConstructorStats.detail_reg_inst() == n_inst + 13 del a1, a2, b1, d1, e1, e2 > assert [i.alive() for i in cstats] == [7, 4] E assert [9, 6] == [7, 4] E At index 0 diff: 9 != 7 E Use -v to get more diff PythFactory7 = <class 'test_factory_constructors.test_init_factory_dual.<locals>.PythFactory7'> TestFactory7 = <class 'pybind11_tests.factory_constructors.TestFactory7'> b2 = <test_factory_constructors.test_init_factory_dual.<locals>.PythFactory7 object at 0x7f2b96812c90> c1 = <pybind11_tests.factory_constructors.TestFactory7 object at 0x7f2b962f6b70> c2 = <test_factory_constructors.test_init_factory_dual.<locals>.PythFactory7 object at 0x7f2b96323c50> cstats = [<pybind11_tests.ConstructorStats object at 0x7f2b96604a30>, <pybind11_tests.ConstructorStats object at 0x7f2b96927f70>] d2 = <test_factory_constructors.test_init_factory_dual.<locals>.PythFactory7 object at 0x7f2b96813cb0> excinfo = <ExceptionInfo TypeError('pybind11::init(): construction failed: returned holder-wrapped instance is not an alias instance') tblen=1> f1 = <pybind11_tests.factory_constructors.TestFactory7 object at 0x7f2d1a549830> f2 = <test_factory_constructors.test_init_factory_dual.<locals>.PythFactory7 object at 0x7f2b96321a30> g1 = <pybind11_tests.factory_constructors.TestFactory7 object at 0x7f2b969b4930> n_inst = 68 ../../tests/test_factory_constructors.py:291: AssertionError ----------------------------- Captured stdout call ----------------------------- ### TestFactory7 @ 0x7ffc197a7c60 created 1 ### TestFactory7 @ 0x55c4b45cd6f0 created via move constructor ### TestFactory7 @ 0x7ffc197a7c60 destroyed ### TestFactory7 @ 0x7ffc197a7c60 created 2 ### PyTF7 @ 0x7ffc197a7c60 created 2 ### TestFactory7 @ 0x55c4b45ab450 created via move constructor ### PyTF7 @ 0x55c4b45ab450 created via move constructor ### PyTF7 @ 0x7ffc197a7c60 destroyed ### TestFactory7 @ 0x7ffc197a7c60 destroyed ### TestFactory7 @ 0x55c4b45a7ce0 created 3 ### TestFactory7 @ 0x55c4b45a7b80 created 4 ### PyTF7 @ 0x55c4b45a7b80 created 4 ### TestFactory7 @ 0x55c4b45cddb0 created 5 ### TestFactory7 @ 0x7ffc197a7ca0 created 6 ### PyTF7 @ 0x7ffc197a7ca0 created 6 ### TestFactory7 @ 0x55c4b45ce200 created via move constructor ### PyTF7 @ 0x55c4b45ce200 created via move constructor ### PyTF7 @ 0x7ffc197a7ca0 destroyed ### TestFactory7 @ 0x7ffc197a7ca0 destroyed ### TestFactory7 @ 0x55c4b45cddf0 created 7 ### TestFactory7 @ 0x55c4b45ce2a0 created 8 ### PyTF7 @ 0x55c4b45ce2a0 created 8 ### TestFactory7 @ 0x55c4b45d1da0 created 9 ### PyTF7 @ 0x55c4b45d1da0 created 9 ### TestFactory7 @ 0x55c4b45d1ec0 created 100 ### PyTF7 @ 0x55c4b45d1ec0 created 100 ### TestFactory7 @ 0x55c4b45ab490 created 11 ### TestFactory7 @ 0x55c4b45d2080 created 12 ### PyTF7 @ 0x55c4b45d2080 created 12 ### TestFactory7 @ 0x55c4b45c4460 created 13 ### TestFactory7 @ 0x55c4b45d20d0 created 14 ### TestFactory7 @ 0x55c4b45d20d0 destroyed ### TestFactory7 @ 0x55c4b45cd6f0 destroyed ### TestFactory7 @ 0x55c4b45a7ce0 destroyed ### TestFactory7 @ 0x55c4b45cddf0 destroyed ### PyTF7 @ 0x55c4b45d1da0 destroyed ### TestFactory7 @ 0x55c4b45d1da0 destroyed ________________________________ test_override _________________________________ capture = <conftest.Capture object at 0x7f2b962e9a30> msg = <conftest.SanitizedString object at 0x7f2b962e9b50> def test_override(capture, msg): class ExtendedExampleVirt(m.ExampleVirt): def __init__(self, state): super().__init__(state + 1) self.data = "Hello world" def run(self, value): print(f"ExtendedExampleVirt::run({value}), calling parent..") return super().run(value + 1) def run_bool(self): print("ExtendedExampleVirt::run_bool()") return False def get_string1(self): return "override1" def pure_virtual(self): print(f"ExtendedExampleVirt::pure_virtual(): {self.data}") class ExtendedExampleVirt2(ExtendedExampleVirt): def __init__(self, state): super().__init__(state + 1) def get_string2(self): return "override2" ex12 = m.ExampleVirt(10) with capture: assert m.runExampleVirt(ex12, 20) == 30 assert ( capture == """ Original implementation of ExampleVirt::run(state=10, value=20, str1=default1, str2=default2) """ ) with pytest.raises(RuntimeError) as excinfo: m.runExampleVirtVirtual(ex12) assert ( msg(excinfo.value) == 'Tried to call pure virtual function "ExampleVirt::pure_virtual"' ) ex12p = ExtendedExampleVirt(10) with capture: assert m.runExampleVirt(ex12p, 20) == 32 assert ( capture == """ ExtendedExampleVirt::run(20), calling parent.. Original implementation of ExampleVirt::run(state=11, value=21, str1=override1, str2=default2) """ ) with capture: assert m.runExampleVirtBool(ex12p) is False assert capture == "ExtendedExampleVirt::run_bool()" with capture: m.runExampleVirtVirtual(ex12p) assert capture == "ExtendedExampleVirt::pure_virtual(): Hello world" ex12p2 = ExtendedExampleVirt2(15) with capture: assert m.runExampleVirt(ex12p2, 50) == 68 assert ( capture == """ ExtendedExampleVirt::run(50), calling parent.. Original implementation of ExampleVirt::run(state=17, value=51, str1=override1, str2=override2) """ ) cstats = ConstructorStats.get(m.ExampleVirt) assert cstats.alive() == 3 del ex12, ex12p, ex12p2 > assert cstats.alive() == 0 E assert 2 == 0 E + where 2 = <bound method PyCapsule.alive of <pybind11_tests.ConstructorStats object at 0x7f2b96870870>>() E + where <bound method PyCapsule.alive of <pybind11_tests.ConstructorStats object at 0x7f2b96870870>> = <pybind11_tests.ConstructorStats object at 0x7f2b96870870>.alive ExtendedExampleVirt = <class 'test_virtual_functions.test_override.<locals>.ExtendedExampleVirt'> ExtendedExampleVirt2 = <class 'test_virtual_functions.test_override.<locals>.ExtendedExampleVirt2'> capture = <conftest.Capture object at 0x7f2b962e9a30> cstats = <pybind11_tests.ConstructorStats object at 0x7f2b96870870> excinfo = <ExceptionInfo RuntimeError('Tried to call pure virtual function "ExampleVirt::pure_virtual"') tblen=1> msg = <conftest.SanitizedString object at 0x7f2b962e9b50> ../../tests/test_virtual_functions.py:84: AssertionError ----------------------------- Captured stdout call ----------------------------- ### ExampleVirt @ 0x55c4b45f5ca0 destroyed =========================== short test summary info ============================ SKIPPED [1] ../../tests/test_stl.py:147: no <experimental/optional> SKIPPED [1] ../../tests/test_stl.py:179: no <boost/optional> FAILED ../../tests/test_factory_constructors.py::test_init_factory_alias - as... FAILED ../../tests/test_factory_constructors.py::test_init_factory_dual - ass... FAILED ../../tests/test_virtual_functions.py::test_override - assert 2 == 0 ================== 3 failed, 863 passed, 2 skipped in 26.04s ===================
Will you be able to work on this?
Comaintainers highly welcome, I find I have very little time to do anything nowadays.. I found an upstream bug at https://github.com/pybind/pybind11/issues/4870 and noted that this is an issue in Fedora.
Solved by update to pybind11-2.13.1