Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
befeleme opened this issue Dec 18, 2024 · 5 comments
Closed

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

befeleme opened this issue Dec 18, 2024 · 5 comments
Labels
tests Tests in the Lib/test dir topic-free-threading type-bug An unexpected behavior, bug, or error

Comments

@befeleme
Copy link
Contributor

befeleme commented Dec 18, 2024

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

@befeleme befeleme added the type-bug An unexpected behavior, bug, or error label Dec 18, 2024
@Eclips4 Eclips4 added tests Tests in the Lib/test dir topic-free-threading labels Dec 18, 2024
@vstinner
Copy link
Member

cc @ericsnowcurrently

@befeleme befeleme changed the title AssertionError in test_tuple_repeat_respect_immortality, test_immortals during the freethreading-debug build on i686 AssertionError in test_{tuple,list}_repeat_respect_immortality, test_immortals during the freethreading-debug build on i686 Dec 18, 2024
@ZeroIntensity
Copy link
Member

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

vstinner added a commit to vstinner/cpython that referenced this issue Dec 18, 2024
On 32-bit systems, _Py_IMMORTAL_INITIAL_REFCNT is defined as 5 << 28,
not 7 << 28.
@vstinner
Copy link
Member

vstinner commented Dec 18, 2024

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.

@vstinner
Copy link
Member

I created PR gh-128068 to fix this regression.

@vstinner vstinner changed the title AssertionError in test_{tuple,list}_repeat_respect_immortality, test_immortals during the freethreading-debug build on i686 [Free Threading] test_builtin.ImmortalTests fail on i686 (32-bit) Dec 18, 2024
vstinner added a commit that referenced this issue Dec 20, 2024
On 32-bit Free Threading systems, immortal reference count
is 5 << 28, instead of 7 << 28.

Co-authored-by: Peter Bierma <[email protected]>
@vstinner
Copy link
Member

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

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Dec 23, 2024
On 32-bit Free Threading systems, immortal reference count
is 5 << 28, instead of 7 << 28.

Co-authored-by: Peter Bierma <[email protected]>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 8, 2025
On 32-bit Free Threading systems, immortal reference count
is 5 << 28, instead of 7 << 28.

Co-authored-by: Peter Bierma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-free-threading type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants