diff --git a/Lib/test/test_free_threading/test_races.py b/Lib/test/test_free_threading/test_races.py index 23b48c76195408..f08de7496eb526 100644 --- a/Lib/test/test_free_threading/test_races.py +++ b/Lib/test/test_free_threading/test_races.py @@ -272,6 +272,8 @@ def mutate(): do_race(set_value, mutate) def test_racing_recursion_limit(self): + self.addCleanup(sys.setrecursionlimit, sys.getrecursionlimit()) + def something_recursive(): def count(n): if n > 0: diff --git a/Misc/NEWS.d/next/Tests/2026-10-13-13-34-00.gh-issue-159293.Lr8q2N.rst b/Misc/NEWS.d/next/Tests/2026-10-13-13-34-00.gh-issue-159293.Lr8q2N.rst new file mode 100644 index 00000000000000..2a122343a3fe2a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-10-13-13-34-00.gh-issue-159293.Lr8q2N.rst @@ -0,0 +1,2 @@ +Restore the recursion limit after the free-threading recursion-limit race test +to avoid failures in subsequent tests run in the same process.