https://github.com/python/cpython/commit/aeff4cb4c4b38744037f7ea88d2241c66c17a7eb
commit: aeff4cb4c4b38744037f7ea88d2241c66c17a7eb
branch: main
author: Noah <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-10-14T10:38:50+08:00
summary:

gh-159293: Restore the recursion limit after the free-threading race test 
(#159311)

Adds a cleanup to ensure interpreter state is restored after testing recursion
limit changes.

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 23b48c761954084..f08de7496eb526d 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 000000000000000..2a122343a3fe2af
--- /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