Skip to content

[3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir() (#149659)#149799

Merged
warsaw merged 2 commits into
python:3.15from
warsaw:backport-b162307-3.15
May 13, 2026
Merged

[3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir() (#149659)#149799
warsaw merged 2 commits into
python:3.15from
warsaw:backport-b162307-3.15

Conversation

@warsaw
Copy link
Copy Markdown
Member

@warsaw warsaw commented May 13, 2026

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 b162307)

…te.addsitedir() (python#149659)

* Add re-entrant tests for pythongh-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 python#149504

(cherry picked from commit b162307)
@warsaw warsaw self-assigned this May 13, 2026
@warsaw warsaw requested a review from FFY00 as a code owner May 13, 2026 19:10
@warsaw warsaw changed the title gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add… [3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir() (#149659) May 13, 2026
@warsaw warsaw merged commit 45fc9ac into python:3.15 May 13, 2026
54 checks passed
@warsaw warsaw deleted the backport-b162307-3.15 branch May 13, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant