python/cpython

[Free Threading] test_builtin.ImmortalTests fail on i686 (32-bit)

Closed this issue · 5 comments

Bug report

Bug description:

In Fedora Linux, when building 3.14.0a3 on i686 architecture and freethreading-debug build, test_tuple_respect_immortality, test_list_repeat_respect_immortality and test_immortals fail.
This is not happening on x86_64, aarch64. We don't know about the other arches yet.

FAIL: test_tuple_repeat_respect_immortality (test.test_builtin.ImmortalTests.test_tuple_repeat_respect_immortality) [256]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3.14-3.14.0_a3-build/Python-3.14.0a3/Lib/test/test_builtin.py", line 2702, in assert_immortal
    self.assertEqual(sys.getrefcount(immortal), self.IMMORTAL_REFCOUNT)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1342177280 != 1879048192

FAIL: test_immortals (test.test_builtin.ImmortalTests.test_immortals) [None]
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.14.0a3/Lib/test/test_builtin.py", line 2702, in assert_immortal
    self.assertEqual(sys.getrefcount(immortal), self.IMMORTAL_REFCOUNT)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1342177280 != 1879048192

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

I think this is probably because there's a different reference count for heap immortals and static immortals now (#127797). Does this occur on non-free-threaded builds?

cc @markshannon

Ah, it's a simple typo in ImmortalTests.IMMORTAL_REFCOUNT: on 32-bit systems, _Py_IMMORTAL_INITIAL_REFCNT is defined as 5 << 28, not as 7 << 28.

Free Threading uses a different value for immortal objects.

I created PR gh-128068 to fix this regression.

Fixed by change daa260e. Thanks for the report @befeleme.