René's URL Explorer Experiment


Title: gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir() by warsaw · Pull Request #149659 · python/cpython · GitHub

Open Graph Title: gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir() by warsaw · Pull Request #149659 · python/cpython

X Title: gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir() by warsaw · Pull Request #149659 · python/cpython

Description: The Python programming language. Contribute to python/cpython development by creating an account on GitHub.

Open Graph Description: Fix site.addsitedir() to allow re-entrant calls from within startup files. Previously, a .pth file containing an import line that called site.addsitedir() (or a .start entry point doing the same) ...

X Description: Fix site.addsitedir() to allow re-entrant calls from within startup files. Previously, a .pth file containing an import line that called site.addsitedir() (or a .start entry point doing the same) ...

Opengraph URL: https://github.com/python/cpython/pull/149659

X: @github

direct link

Domain: github.com

route-pattern/_view_fragments/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:94d64ce5-6ca3-2540-4717-5929208d80df
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE338:320B78:117DB52:194E8FB:6A563531
html-safe-noncef9db02ea0c9ad62bf5915b931c4ba81ced2e72e5eb9b8126f2b1d734fe2b8567
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzM4OjMyMEI3ODoxMTdEQjUyOjE5NEU4RkI6NkE1NjM1MzEiLCJ2aXNpdG9yX2lkIjoiMTM4OTEzNDIwMjE4MDg3NTU2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacae1df2f30a2dfb4faf899fb659440575e991420a8619a8041eeebdbcba3352ca
hovercard-subject-tagpull_request:3659873785
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/python/cpython/149659/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/3f59a57cf146a5235025d0d15b157fdbc59c2899f92238f2822607eae5ca96dd/python/cpython/pull/149659
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3f59a57cf146a5235025d0d15b157fdbc59c2899f92238f2822607eae5ca96dd/python/cpython/pull/149659
og:image:altFix site.addsitedir() to allow re-entrant calls from within startup files. Previously, a .pth file containing an import line that called site.addsitedir() (or a .start entry point doing the same) ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewarsaw
hostnamegithub.com
expected-hostnamegithub.com
None9d78ea552aac0685ca5f006d44f88166cbbf3bb96843f8da0c5a2c0b9908430b
turbo-cache-controlno-cache
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423b2fb76ac2b90de5ab599b7a76a0d2b2c83f24
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/149659#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F149659
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F149659
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/149659
Reloadhttps://github.com/python/cpython/pull/149659
Reloadhttps://github.com/python/cpython/pull/149659
Please reload this pagehttps://github.com/python/cpython/pull/149659
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/149659
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
warsawhttps://github.com/warsaw
python:mainhttps://github.com/python/cpython/tree/main
warsaw:gh-149504https://github.com/warsaw/cpython/tree/gh-149504
Conversationhttps://github.com/python/cpython/pull/149659
Commits9 (9)https://github.com/python/cpython/pull/149659/commits
Checkshttps://github.com/python/cpython/pull/149659/checks
Files changedhttps://github.com/python/cpython/pull/149659/files
gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir()https://github.com/python/cpython/pull/149659#top
warsawhttps://github.com/warsaw
python:mainhttps://github.com/python/cpython/tree/main
warsaw:gh-149504https://github.com/warsaw/cpython/tree/gh-149504
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 11, 2026https://github.com/python/cpython/pull/149659#issue-4418837782
Please reload this pagehttps://github.com/python/cpython/pull/149659
#149516https://github.com/python/cpython/pull/149516
@ncoghlanhttps://github.com/ncoghlan
@zsolhttps://github.com/zsol
@JelleZijlstrahttps://github.com/JelleZijlstra
[3.15] Re-entrant calls to site.addsitedir() can fail (affecting uv run) #149504https://github.com/python/cpython/issues/149504
Please reload this pagehttps://github.com/python/cpython/pull/149659
warsawhttps://github.com/warsaw
May 10, 2026 21:00https://github.com/python/cpython/pull/149659#commits-pushed-7108fb7
https://github.com/warsaw
Add re-entrant tests forhttps://github.com/python/cpython/pull/149659/commits/7108fb7024a7cc4ba785401b8cdfc9aab8999dde
pythongh-149504https://github.com/python/cpython/issues/149504
7108fb7https://github.com/python/cpython/pull/149659/commits/7108fb7024a7cc4ba785401b8cdfc9aab8999dde
https://github.com/warsaw
Add end-to-end integration test coveragehttps://github.com/python/cpython/pull/149659/commits/aae5378fc3095f127b69a623e761ae7b2b848326
aae5378https://github.com/python/cpython/pull/149659/commits/aae5378fc3095f127b69a623e761ae7b2b848326
https://github.com/warsaw
Implement a state class to process .pth and .start fileshttps://github.com/python/cpython/pull/149659/commits/dc96d5d726a9864eb871feb5a4b2a4989153722b
dc96d5dhttps://github.com/python/cpython/pull/149659/commits/dc96d5d726a9864eb871feb5a4b2a4989153722b
python#149504https://github.com/python/cpython/issues/149504
https://github.com/warsaw
Add a blurbhttps://github.com/python/cpython/pull/149659/commits/c6cfcb03f80b563fdb40040b87c39eedafcf2b14
c6cfcb0https://github.com/python/cpython/pull/149659/commits/c6cfcb03f80b563fdb40040b87c39eedafcf2b14
https://github.com/warsaw
One small round of cleanup.https://github.com/python/cpython/pull/149659/commits/04b67f7d8e9752f11781c67f78cd766693d393f2
04b67f7https://github.com/python/cpython/pull/149659/commits/04b67f7d8e9752f11781c67f78cd766693d393f2
https://github.com/warsaw
warsawhttps://github.com/warsaw
FFY00https://github.com/FFY00
code ownerhttps://github.com/python/cpython/blob/f23a1837d7156c4c478528321a423eae2b31e4bf/.github/CODEOWNERS#L576
May 11, 2026 07:18https://github.com/python/cpython/pull/149659#event-25370051209
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 11, 2026https://github.com/python/cpython/pull/149659#event-25370055015
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting core review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20core%20review%22
May 11, 2026https://github.com/python/cpython/pull/149659#event-25370055489
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
May 11, 2026 https://github.com/python/cpython/pull/149659#ref-issue-4400801061
[3.15] Re-entrant calls to site.addsitedir() can fail (affecting uv run) #149504 https://github.com/python/cpython/issues/149504
https://github.com/warsaw
warsawhttps://github.com/warsaw
JelleZijlstrahttps://github.com/JelleZijlstra
StanFromIrelandhttps://github.com/StanFromIreland
ncoghlanhttps://github.com/ncoghlan
May 11, 2026 07:19https://github.com/python/cpython/pull/149659#event-25370081703
https://github.com/warsaw
Merge branch 'main' intohttps://github.com/python/cpython/pull/149659/commits/c38ec2b268b1228acb3a706f6d3d057fbf258347
pythongh-149504https://github.com/python/cpython/issues/149504
c38ec2bhttps://github.com/python/cpython/pull/149659/commits/c38ec2b268b1228acb3a706f6d3d057fbf258347
https://github.com/zsol
zsolhttps://github.com/zsol
May 11, 2026 https://github.com/python/cpython/pull/149659#pullrequestreview-4262380747
View reviewed changes https://github.com/python/cpython/pull/149659/files/9c488d71ccb4a0cd18a5043040a59f4ffb63fea3
zsolhttps://github.com/zsol
https://github.com/python/cpython/pull/149659#pullrequestreview-4262380747
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#149516https://github.com/python/cpython/pull/149516
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/warsaw
Merge branch 'main' intohttps://github.com/python/cpython/pull/149659/commits/ea344462b0a5687f18d9bc83e9dc46d14211a4d1
pythongh-149504https://github.com/python/cpython/issues/149504
ea34446https://github.com/python/cpython/pull/149659/commits/ea344462b0a5687f18d9bc83e9dc46d14211a4d1
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
May 11, 2026https://github.com/python/cpython/pull/149659#issuecomment-4422553284
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 11, 2026https://github.com/python/cpython/pull/149659#issuecomment-4422717751
@zsolhttps://github.com/zsol
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 12, 2026 https://github.com/python/cpython/pull/149659#ref-pullrequest-4409344113
gh-75723: Fix double evaluation of .pth and .site files in venvs #149583 https://github.com/python/cpython/pull/149583
warsawhttps://github.com/warsaw
May 12, 2026 13:02https://github.com/python/cpython/pull/149659#commits-pushed-558ece4
https://github.com/warsaw
Merge branch 'main' intohttps://github.com/python/cpython/pull/149659/commits/558ece4be223242a69a397fda8a636e225624f3a
pythongh-149504https://github.com/python/cpython/issues/149504
558ece4https://github.com/python/cpython/pull/149659/commits/558ece4be223242a69a397fda8a636e225624f3a
https://github.com/warsaw
Merge branch 'main' intohttps://github.com/python/cpython/pull/149659/commits/9c488d71ccb4a0cd18a5043040a59f4ffb63fea3
pythongh-149504https://github.com/python/cpython/issues/149504
9c488d7https://github.com/python/cpython/pull/149659/commits/9c488d71ccb4a0cd18a5043040a59f4ffb63fea3
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 13, 2026 15:54https://github.com/python/cpython/pull/149659#event-25489989564
https://github.com/warsaw
warsawhttps://github.com/warsaw
b162307https://github.com/python/cpython/commit/b162307d7f216e87976d76c9b8f4a932961cb2d4
May 13, 2026https://github.com/python/cpython/pull/149659#event-25492039363
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting core review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20core%20review%22
May 13, 2026https://github.com/python/cpython/pull/149659#event-25492042334
https://github.com/warsaw
warsawhttps://github.com/warsaw
3.15 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A3.15
needs backport to 3.15 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22needs%20backport%20to%203.15%22
May 13, 2026https://github.com/python/cpython/pull/149659#event-25495751201
https://github.com/apps/miss-islington-app
miss-islington-apphttps://github.com/apps/miss-islington-app
May 13, 2026https://github.com/python/cpython/pull/149659#issuecomment-4444087465
@warsawhttps://github.com/warsaw
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/apps/miss-islington-app
miss-islington-apphttps://github.com/apps/miss-islington-app
May 13, 2026https://github.com/python/cpython/pull/149659#issuecomment-4444087899
@warsawhttps://github.com/warsaw
cherry_pickerhttps://pypi.org/project/cherry-picker/
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 13, 2026 18:29https://github.com/python/cpython/pull/149659#event-25495850275
https://github.com/warsaw
warsawhttps://github.com/warsaw
May 13, 2026 https://github.com/python/cpython/pull/149659#ref-pullrequest-4440515939
[3.15] gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.add sitedir() (#149659) #149799 https://github.com/python/cpython/pull/149799
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
May 13, 2026https://github.com/python/cpython/pull/149659#issuecomment-4444443962
GH-149799https://github.com/python/cpython/pull/149799
3.15 branchhttps://github.com/python/cpython/tree/3.15
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
needs backport to 3.15 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22needs%20backport%20to%203.15%22
May 13, 2026https://github.com/python/cpython/pull/149659#event-25497411148
https://github.com/zsol
zsolhttps://github.com/zsol
May 13, 2026 https://github.com/python/cpython/pull/149659#ref-pullrequest-4440723205
Remove site startup patch astral-sh/python-build-standalone#1130 https://github.com/astral-sh/python-build-standalone/pull/1130
warsawhttps://github.com/warsaw
May 13, 2026 https://github.com/python/cpython/pull/149659#ref-commit-45fc9ac
https://github.com/warsaw
[3.15]https://github.com/python/cpython/commit/45fc9acb8cffd4009aedb8fdf2fce2add89f38bb
gh-149504https://github.com/python/cpython/issues/149504
: Fix re-entrancy bug when .pth/.start file invokes s…https://github.com/python/cpython/commit/45fc9acb8cffd4009aedb8fdf2fce2add89f38bb
45fc9achttps://github.com/python/cpython/commit/45fc9acb8cffd4009aedb8fdf2fce2add89f38bb
#149659https://github.com/python/cpython/pull/149659
#149799https://github.com/python/cpython/pull/149799
gh-149504https://github.com/python/cpython/issues/149504
#149659https://github.com/python/cpython/pull/149659
gh-149504https://github.com/python/cpython/issues/149504
#149504https://github.com/python/cpython/issues/149504
b162307https://github.com/python/cpython/commit/b162307d7f216e87976d76c9b8f4a932961cb2d4
https://github.com/scoder
scoderhttps://github.com/scoder
May 19, 2026 https://github.com/python/cpython/pull/149659#ref-issue-4443883056
New site.py implementation fails to load .pth files in subprocesses #149819 https://github.com/python/cpython/issues/149819
https://github.co/hiddenchars
https://github.com/python/cpython/pull/{{ revealButtonHref }}
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F149659
https://github.com/FFY00
FFY00 https://github.com/FFY00
https://github.com/ncoghlan
ncoghlan https://github.com/ncoghlan
https://github.com/JelleZijlstra
JelleZijlstra https://github.com/JelleZijlstra
https://github.com/StanFromIreland
StanFromIreland https://github.com/StanFromIreland
https://github.com/zsol
zsol https://github.com/zsol
https://github.com/python/cpython/pull/149659/files/9c488d71ccb4a0cd18a5043040a59f4ffb63fea3
https://github.com/warsaw
warsaw https://github.com/warsaw
3.15 https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A3.15
Please reload this pagehttps://github.com/python/cpython/pull/149659
https://github.com/warsaw
https://github.com/JelleZijlstra
https://github.com/zsol
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.