diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-07-28 09:48:57 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-08-05 16:31:46 +0200 |
| commit | 119ef9f7af2c4da98dd678f7d5d1a88f594cf95d (patch) | |
| tree | 794eea8bef71766e6c8ee5cc3dbb213697d0d746 /sources/pyside6/tests/QtWidgets/bug_576.py | |
| parent | 687d8ea785ad11c30db2d3542c6ba11e41c57851 (diff) | |
Fix reference count tests (1) to pass in Python 3.14 (simple cases)
As of 3.14, the interpreter will sometimes just borrow references and
newly created objects may have different initial reference counts. Fix
the test cases where a base ref count of a new object is compared
against.
Pick-to: 6.9 6.8
Task-number: PYSIDE-3147
Change-Id: I698be2309362fc65f6727971a5cec4fc4f40cf2e
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/tests/QtWidgets/bug_576.py')
| -rw-r--r-- | sources/pyside6/tests/QtWidgets/bug_576.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sources/pyside6/tests/QtWidgets/bug_576.py b/sources/pyside6/tests/QtWidgets/bug_576.py index b11e35420..3d8581201 100644 --- a/sources/pyside6/tests/QtWidgets/bug_576.py +++ b/sources/pyside6/tests/QtWidgets/bug_576.py @@ -31,13 +31,13 @@ class Bug576(unittest.TestCase): b = QPushButton("test") b.destroyed[QObject].connect(self.onButtonDestroyed) - self.assertEqual(sys.getrefcount(b), 2) + base_ref_count = sys.getrefcount(b) b.setParent(w) - self.assertEqual(sys.getrefcount(b), 3) + self.assertEqual(sys.getrefcount(b), base_ref_count + 1) b.parent() - self.assertEqual(sys.getrefcount(b), 3) + self.assertEqual(sys.getrefcount(b), base_ref_count + 1) b.setParent(None) - self.assertEqual(sys.getrefcount(b), 2) + self.assertEqual(sys.getrefcount(b), base_ref_count) del b # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() |
