From 35b5cff5c32af99e0ef506e67878dcf50175bdf3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 18 Dec 2024 15:06:51 +0100 Subject: [PATCH 1/2] gh-128058: Fix test_builtin ImmortalTests On 32-bit systems, _Py_IMMORTAL_INITIAL_REFCNT is defined as 5 << 28, not 7 << 28. --- Lib/test/test_builtin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index a92edad86839e6..f9027f6cd288bc 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -2691,7 +2691,7 @@ def __del__(self): class ImmortalTests(unittest.TestCase): if sys.maxsize < (1 << 32): - IMMORTAL_REFCOUNT = 7 << 28 + IMMORTAL_REFCOUNT = 5 << 28 else: IMMORTAL_REFCOUNT = 3 << 30 From 368f7f68be5aaf912585105acb355fdc06486f20 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 18 Dec 2024 15:27:34 +0100 Subject: [PATCH 2/2] Fix for build with the GIL --- Lib/test/test_builtin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index f9027f6cd288bc..f98138391bc1a8 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -2691,7 +2691,10 @@ def __del__(self): class ImmortalTests(unittest.TestCase): if sys.maxsize < (1 << 32): - IMMORTAL_REFCOUNT = 5 << 28 + if support.Py_GIL_DISABLED: + IMMORTAL_REFCOUNT = 5 << 28 + else: + IMMORTAL_REFCOUNT = 7 << 28 else: IMMORTAL_REFCOUNT = 3 << 30