mirror of
https://github.com/python/cpython.git
synced 2025-07-27 05:04:15 +00:00
[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 b309c8ebff
)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
b3074f0d5e
commit
cceb758c78
8 changed files with 35 additions and 6 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue