Skip to content

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

Merged
freakboy3742 merged 1 commit into
python:mainfrom
zolaski333:codex/gh-159293-restore-recursion-limit
Oct 14, 2026
Merged

freakboy3742 merged 1 commit into
python:mainfrom
zolaski333:codex/gh-159293-restore-recursion-limit

Conversation

@zolaski333

@zolaski333 zolaski333 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

test_racing_recursion_limit leaves the interpreter's recursion limit at 199. When tests share a process, the Python lru_cache recursion test and 68 pickle cases subsequently raise RecursionError.

Register a cleanup to restore the original recursion limit even if the race test fails. This preserves the existing concurrency test and follows the TestCase.addCleanup pattern used elsewhere in the suite.

Fixes gh-159293.

Validation on Windows x64, CPython main at 50082b8d893, free-threaded Release build with the GIL disabled:

  • Before the fix: race test passes but changes the limit from 1000 to 199; TestLRUPy.test_lru_recursion has one error and test_pickle has 68 errors.
  • After the fix: limit remains 1000; the same 1086 tests complete without errors (42 skipped).
  • PCbuild/amd64t/python.exe -X dev -m test --single-process --no-randomize test_free_threading test_functools test_pickle: SUCCESS, 1674 tests run, 52 skipped; 55 test files passed and six platform-specific files skipped.
  • Tools/patchcheck/patchcheck.py and git diff --check pass.

@@ -0,0 +1,2 @@
Restore the recursion limit after the free-threading recursion-limit race test

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test only changes don't requires a news entry file, please remove it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Tests' is one of the blurb options, for test-only PRs, and this was put in the Tests section.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aisk aisk added the skip news label Oct 13, 2026
@freakboy3742 freakboy3742 added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 14, 2026

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@freakboy3742
freakboy3742 merged commit aeff4cb into python:main Oct 14, 2026
66 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @zolaski333 for the PR, and @freakboy3742 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Oct 14, 2026

Copy link
Copy Markdown

GH-159389 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 14, 2026
@bedevere-app

bedevere-app Bot commented Oct 14, 2026

Copy link
Copy Markdown

GH-159390 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 14, 2026
freakboy3742 pushed a commit that referenced this pull request Oct 14, 2026
…g race test (GH-159311) (#159390)

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

Co-authored-by: Noah <57315647+zolaski333@users.noreply.github.com>
freakboy3742 pushed a commit that referenced this pull request Oct 14, 2026
…g race test (GH-159311) (#159389)

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

Co-authored-by: Noah <57315647+zolaski333@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test ordering error with free-threaded builds

4 participants