diff options
author | Sam Gross <colesbury@gmail.com> | 2024-05-10 16:29:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 16:29:29 -0400 |
commit | b309c8ebff011f27012367b046ff92eecbdd68a5 (patch) | |
tree | 272bfaeb2fe212767357c40423f54e5e92b31d24 /Lib/test/test_trace.py | |
parent | aa36f83c1670f1e41fa9432a20e5c4a88ee9012c (diff) | |
download | cpython-b309c8ebff011f27012367b046ff92eecbdd68a5.tar.gz cpython-b309c8ebff011f27012367b046ff92eecbdd68a5.zip |
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_trace.py')
-rw-r--r-- | Lib/test/test_trace.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index 93966ee31d0..7ff3fe4091d 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -1,7 +1,7 @@ import os from pickle import dump import sys -from test.support import captured_stdout, requires_resource +from test.support import captured_stdout, requires_resource, requires_gil_enabled from test.support.os_helper import (TESTFN, rmtree, unlink) from test.support.script_helper import assert_python_ok, assert_python_failure import textwrap @@ -301,6 +301,7 @@ class TestFuncs(unittest.TestCase): @unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(), 'pre-existing trace function throws off measurements') + @requires_gil_enabled("gh-117783: immortalization of types affects traced method names") def test_inst_method_calling(self): obj = TracedClass(20) self.tracer.runfunc(obj.inst_method_calling, 1) @@ -334,6 +335,7 @@ class TestCallers(unittest.TestCase): @unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(), 'pre-existing trace function throws off measurements') + @requires_gil_enabled("gh-117783: immortalization of types affects traced method names") def test_loop_caller_importing(self): self.tracer.runfunc(traced_func_importing_caller, 1) |