X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_message_iterator.py;fp=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_message_iterator.py;h=e121c973c4325e46f2398c1a38eed5a9140aa1b8;hb=a3788aca531e52aedc2682b6071db9fb77a6472f;hp=81aa10e16c88fe178ef7b982286579aea27efd8e;hpb=c719eabb20cebe8c01b76d5af4f020c3af6e6842;p=babeltrace.git diff --git a/tests/bindings/python/bt2/test_message_iterator.py b/tests/bindings/python/bt2/test_message_iterator.py index 81aa10e1..e121c973 100644 --- a/tests/bindings/python/bt2/test_message_iterator.py +++ b/tests/bindings/python/bt2/test_message_iterator.py @@ -380,6 +380,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