X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_message_iterator.py;fp=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_message_iterator.py;h=651a66b55cf230847694c58d7f295ba11e74afbd;hp=3cbe26f2568894698d0a3a0538ebf60a324ff36b;hb=da110483eccb522d3db135a903bb1366cd039207;hpb=cd588ad8414db4a7d36e12625991bd862e5273d0 diff --git a/tests/bindings/python/bt2/test_message_iterator.py b/tests/bindings/python/bt2/test_message_iterator.py index 3cbe26f2..651a66b5 100644 --- a/tests/bindings/python/bt2/test_message_iterator.py +++ b/tests/bindings/python/bt2/test_message_iterator.py @@ -331,6 +331,14 @@ class UserMessageIteratorTestCase(unittest.TestCase): # This verifies that we are not missing an incref of Py_None, making the # refcount of Py_None reach 0. def test_try_again_many_times(self): + # Starting with Python 3.12, `None` is immortal: its reference + # count operations are no-op. Skip this test in that case. + before = sys.getrefcount(None) + dummy = None # noqa: F841 + + if before == sys.getrefcount(None): + raise unittest.SkipTest("`None` is immortal") + class MyIter(bt2._UserMessageIterator): def __next__(self): raise bt2.TryAgain