diff options
author | Christian Tismer <tismer@stackless.com> | 2021-05-16 12:24:00 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2023-03-21 08:49:56 +0100 |
commit | e8095467f7d0332cc0987e7c541de9906e19fece (patch) | |
tree | c414491f86f34308a051bdb781581b23431a4e20 /sources/shiboken6/tests | |
parent | 18812159a8cd5295ac8d51e37f9021ad21434b90 (diff) |
Implement multiple inheritance correctly, compatible version
PySide does not implement multiple inheritance.
Please see "About Multiple Inheritance in Python" at the issue.
This patch just supports the `__init__` call.
A more consequent implementation will follow that
supports multiple inheritance with every method.
[ChangeLog][pyside6] Cooperative multiple inheritance is now
implemented for all __init__ methods.
Fixes: PYSIDE-1564
Change-Id: I8df805d22c2052c3a9747420a86341f64e29a5ad
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken6/tests')
-rw-r--r-- | sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py b/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py index e655b8051..6fd735379 100644 --- a/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py +++ b/sources/shiboken6/tests/samplebinding/multi_cpp_inheritance_test.py @@ -74,11 +74,16 @@ class MultipleCppDerivedReverseTest(unittest.TestCase): self.assertEqual(s.objectName(), "Hi") def testComplexInstanciation(self): - c = ComplexUseCaseReverse("Hi") - c.setObjectName(c) - self.assertEqual(c.objectName(), "Hi") - c.setX(2); - self.assertEqual(c, Point(2, 0)) + # PYSIDE-1564: This test can no longer work because of this MRO: + # ('ComplexUseCaseReverse', 'Point', 'SimpleUseCase2', 'SimpleUseCase', + # 'ObjectType', 'Str', 'Object', 'object') + # By multiple inheritance Point would be called first but has no argument. + with self.assertRaises(TypeError): + c = ComplexUseCaseReverse("Hi") + # c.setObjectName(c) + # self.assertEqual(c.objectName(), "Hi") + # c.setX(2); + # self.assertEqual(c, Point(2, 0)) if __name__ == '__main__': unittest.main() |