]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir...
authorBarry Warsaw <barry@python.org>
Wed, 13 May 2026 22:45:39 +0000 (15:45 -0700)
committerGitHub <noreply@github.com>
Wed, 13 May 2026 22:45:39 +0000 (15:45 -0700)
commit45fc9acb8cffd4009aedb8fdf2fce2add89f38bb
tree3edfbe40de62da7fae3e57a57538a8ba5e705aa8
parentb6503057b2ac5aa8b976965dc6ccf16bbd13b50d
[3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir() (#149659) (#149799)

* gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir() (#149659)

* Add re-entrant tests for gh-149504
* Add end-to-end integration test coverage

This ensures that future whitebox internal test changes do not regress the
public surface semantics.

* Implement a state class to process .pth and .start files

By using this state class and managing implicit and explicit batching, we make it structurally
impossible to get bitten by re-entrant site startup processing.

Fixes #149504

(cherry picked from commit b162307d7f216e87976d76c9b8f4a932961cb2d4)

* Add myself back to CODEOWNERS
.github/CODEOWNERS
Lib/site.py
Lib/test/test_site.py
Misc/NEWS.d/next/Library/2026-05-10-23-51-23.gh-issue-149504.pDSCbn.rst [new file with mode: 0644]