]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-75723: Fix double evaluation of .pth and .site files in venvs (#149583)
authorBarry Warsaw <barry@python.org>
Mon, 11 May 2026 00:25:39 +0000 (17:25 -0700)
committerGitHub <noreply@github.com>
Mon, 11 May 2026 00:25:39 +0000 (17:25 -0700)
commit197878529f20566c1e4706e8486c9a0e302dfa00
tree29986f23599ae3767dd8646dbce93d5ac0de6474
parentc1dbd51fac072e6008941fb22d89b9fe390c2b24
gh-75723: Fix double evaluation of .pth and .site files in venvs (#149583)

* Idempotent `.pth` execution in `site.addsitedir`
* potentially fix monkeypatch leak?

* fix blind copy paste of recommendation

* Update 2026-03-31-16-15-15.gh-issue-75723.BZ4Rsn.rst

* fix implicit merge conflict with 24c4aecc1674414d3dc3238625802778c4ad29d2

* Add failing tests for gh-75723

Based on @asottle branch !asottle-gh-75723 but refactored for `main`.
This will need a different backport.

* Repair gh-75723

The original fix is here: https://github.com/python/cpython/pull/147951
but I'm refactoring a bit for `main`.

* Refactor _make_mod() so we can use it to create package modules too

* Add myself to CODEOWNERS for the site module

---------

Co-authored-by: anthony sottile <asottile@umich.edu>
Co-authored-by: Filipe LaĆ­ns <lains@riseup.net>
.github/CODEOWNERS
Lib/site.py
Lib/test/test_site.py
Misc/NEWS.d/next/Core_and_Builtins/2026-03-31-16-15-15.gh-issue-75723.BZ4Rsn.rst [new file with mode: 0644]