Title: gh-149819: Fix .pth files not loaded in Python subprocesses by IntentBug · Pull Request #149888 · python/cpython · GitHub
Open Graph Title: gh-149819: Fix .pth files not loaded in Python subprocesses by IntentBug · Pull Request #149888 · python/cpython
X Title: gh-149819: Fix .pth files not loaded in Python subprocesses by IntentBug · Pull Request #149888 · python/cpython
Description: After PR gh-149583 (Fix double evaluation of .pth and .site files in venvs), .pth files are no longer loaded in subprocesses started with subprocess.run([sys.executable, ...]). Root cause: main() seeds known_paths from removeduppaths() with all sys.path entries inherited from the parent process. addsitedir() then skips .pth processing for every directory already in known_paths. Fix (2 changes in Lib/site.py, +10/−6 lines): main(): call removeduppaths() for dedup but start known_paths as a fresh empty set addsitedir(): guard sys.path.append with sitedir not in sys.path to avoid duplicates when called with fresh known_paths Verification: ./python -m test test_site: 90/90 tests pass (0 failures, 6 skipped) Functional test: .pth files correctly processed in subprocess scenario with empty known_paths Functional test (unpatched): .pth files skipped when known_paths is pre-seeded — bug confirmed Closes gh-149819
Open Graph Description: After PR gh-149583 (Fix double evaluation of .pth and .site files in venvs), .pth files are no longer loaded in subprocesses started with subprocess.run([sys.executable, ...]). Root cause: main() s...
X Description: After PR gh-149583 (Fix double evaluation of .pth and .site files in venvs), .pth files are no longer loaded in subprocesses started with subprocess.run([sys.executable, ...]). Root cause: main() s...
Opengraph URL: https://github.com/python/cpython/pull/149888
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:e02b2e34-12a3-c552-5f16-25f14f6f93cc |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A6D0:2D16FA:46F82EA:640F091:6A56CD4F |
| html-safe-nonce | ef432164a13d4ed4f44db16d2ea69df8be51d4c0a2b91d319b2d51e128e22a2e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkQwOjJEMTZGQTo0NkY4MkVBOjY0MEYwOTE6NkE1NkNENEYiLCJ2aXNpdG9yX2lkIjoiMzg0OTI4MzI4MzEyMjA0ODMzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2452922c9d40b6def2a1b1e3f7044c95211b12741e1530f75436a47358491381 |
| hovercard-subject-tag | pull_request:3690805751 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/149888/files |
| twitter:image | https://avatars.githubusercontent.com/u/285003256?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/285003256?s=400&v=4 |
| og:image:alt | After PR gh-149583 (Fix double evaluation of .pth and .site files in venvs), .pth files are no longer loaded in subprocesses started with subprocess.run([sys.executable, ...]). Root cause: main() s... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | df99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3146ab55fc8763ab0e1d2a875e600b3a545bc751 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width