diff options
author | Sam Gross <colesbury@gmail.com> | 2024-05-10 20:29:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 20:29:29 (GMT) |
commit | b309c8ebff011f27012367b046ff92eecbdd68a5 (patch) | |
tree | 272bfaeb2fe212767357c40423f54e5e92b31d24 /Lib/test/test_inspect | |
parent | aa36f83c1670f1e41fa9432a20e5c4a88ee9012c (diff) | |
download | cpython-b309c8ebff011f27012367b046ff92eecbdd68a5.zip cpython-b309c8ebff011f27012367b046ff92eecbdd68a5.tar.gz cpython-b309c8ebff011f27012367b046ff92eecbdd68a5.tar.bz2 |
gh-118846: Fix free-threading test failures when run sequentially (#118864)
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.
Diffstat (limited to 'Lib/test/test_inspect')
-rw-r--r-- | Lib/test/test_inspect/test_inspect.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py index 82e466e..8bd1303 100644 --- a/Lib/test/test_inspect/test_inspect.py +++ b/Lib/test/test_inspect/test_inspect.py @@ -34,7 +34,7 @@ try: except ImportError: ThreadPoolExecutor = None -from test.support import cpython_only, import_helper +from test.support import cpython_only, import_helper, suppress_immortalization from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ from test.support.import_helper import DirsOnSysPath, ready_to_import from test.support.os_helper import TESTFN, temp_cwd @@ -768,6 +768,7 @@ class TestRetrievingSourceCode(GetSourceBase): inspect.getfile(list.append) self.assertIn('expected, got', str(e_append.exception)) + @suppress_immortalization() def test_getfile_class_without_module(self): class CM(type): @property @@ -2430,6 +2431,7 @@ class TestGetattrStatic(unittest.TestCase): self.assertFalse(test.called) + @suppress_immortalization() def test_cache_does_not_cause_classes_to_persist(self): # regression test for gh-118013: # check that the internal _shadowed_dict cache does not cause |