https://github.com/python/cpython/commit/3396c345a314b157a1f22814af897a122042b7a1
commit: 3396c345a314b157a1f22814af897a122042b7a1
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-10-14T12:54:38Z
summary:

[3.15] gh-159293: Restore the recursion limit after the free-threading race 
test (GH-159311) (#159389)

Adds a cleanup to ensure interpreter state is restored after testing recursion
limit changes.
(cherry picked from commit aeff4cb4c4b38744037f7ea88d2241c66c17a7eb)

Co-authored-by: Noah <[email protected]>

files:
A Misc/NEWS.d/next/Tests/2026-10-13-13-34-00.gh-issue-159293.Lr8q2N.rst
M Lib/test/test_free_threading/test_races.py

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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to