summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_capi/test_misc.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-10 20:50:59 (GMT)
committerGitHub <noreply@github.com>2024-05-10 20:50:59 (GMT)
commitcceb758c788adb51ca1660e9d49410c2347feadc (patch)
tree1021c5c2a1f72b735988f614b9e7b3d545800646 /Lib/test/test_capi/test_misc.py
parentb3074f0d5ec4ead75ecce10bf7b7a1459cbf892e (diff)
downloadcpython-cceb758c788adb51ca1660e9d49410c2347feadc.zip
cpython-cceb758c788adb51ca1660e9d49410c2347feadc.tar.gz
cpython-cceb758c788adb51ca1660e9d49410c2347feadc.tar.bz2
[3.13] gh-118846: Fix free-threading test failures when run sequentially (GH-118864) (#118927)
The free-threaded build currently immortalizes some objects once the first thread is started. This can lead to test failures depending on the order in which tests are run. This PR addresses those failures by suppressing immortalization or skipping the affected tests. (cherry picked from commit b309c8ebff011f27012367b046ff92eecbdd68a5) Co-authored-by: Sam Gross <colesbury@gmail.com>
Diffstat (limited to 'Lib/test/test_capi/test_misc.py')
-rw-r--r--Lib/test/test_capi/test_misc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py
index 020e849..ed42d7b 100644
--- a/Lib/test/test_capi/test_misc.py
+++ b/Lib/test/test_capi/test_misc.py
@@ -26,7 +26,8 @@ from test.support import import_helper
from test.support import threading_helper
from test.support import warnings_helper
from test.support import requires_limited_api
-from test.support import requires_gil_enabled, expected_failure_if_gil_disabled
+from test.support import suppress_immortalization
+from test.support import expected_failure_if_gil_disabled
from test.support import Py_GIL_DISABLED
from test.support.script_helper import assert_python_failure, assert_python_ok, run_python_until_end
try:
@@ -481,6 +482,7 @@ class CAPITest(unittest.TestCase):
def test_null_type_doc(self):
self.assertEqual(_testcapi.NullTpDocType.__doc__, None)
+ @suppress_immortalization()
def test_subclass_of_heap_gc_ctype_with_tpdealloc_decrefs_once(self):
class HeapGcCTypeSubclass(_testcapi.HeapGcCType):
def __init__(self):
@@ -498,6 +500,7 @@ class CAPITest(unittest.TestCase):
del subclass_instance
self.assertEqual(type_refcnt - 1, sys.getrefcount(HeapGcCTypeSubclass))
+ @suppress_immortalization()
def test_subclass_of_heap_gc_ctype_with_del_modifying_dunder_class_only_decrefs_once(self):
class A(_testcapi.HeapGcCType):
def __init__(self):