fix: test_message_iterator.py hangs on Python 3.12
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 18 Oct 2023 19:32:00 +0000 (15:32 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 19 Oct 2023 15:02:02 +0000 (11:02 -0400)
commita3788aca531e52aedc2682b6071db9fb77a6472f
tree4e969df2f03efe6f067f9c3c9073ffe7caccaad2
parentc719eabb20cebe8c01b76d5af4f020c3af6e6842
fix: test_message_iterator.py hangs on Python 3.12

Starting with Python 3.12, `None` is immortal: its refcount operations
are NO-OP and sys.getrefcount() will return a static value of UINT_MAX
on 64-bit and UINT_MAX >> 2 on 32-bit.

This basically transform `test_try_again_many_times` in an almost
infinite loop and hangs the testsuite.

Detect this by checking if the refcount on `None` is incremented after
assigning to a variable and skip the test if it's not the case.

See PEP-0683[1] for the gory details.

[1] https://peps.python.org/pep-0683/

Change-Id: Id07658245d524288ce7606cb0a011ad97068dad1
Signed-off-by: Michael Jeanson <mjeanson@debian.org>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10379
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/bindings/python/bt2/test_message_iterator.py
This page took 0.024249 seconds and 4 git commands to generate.