René's URL Explorer Experiment


Title: gh-114940: Add a Per-Interpreter Lock For the List of Thread States by ericsnowcurrently · Pull Request #127115 · python/cpython · GitHub

Open Graph Title: gh-114940: Add a Per-Interpreter Lock For the List of Thread States by ericsnowcurrently · Pull Request #127115 · python/cpython

X Title: gh-114940: Add a Per-Interpreter Lock For the List of Thread States by ericsnowcurrently · Pull Request #127115 · python/cpython

Description: The new lock may be used instead of the global "HEAD" lock. That global lock guards the list of interpreters, but unfortunately in some situations (like for interp->threads.head) it has been used as a generic "lock everything". This change helps us move away from that situation. Note that there are 3 places in pystate.c where we have left HEAD_LOCK()/HEAD_UNLOCK() in place: interpreter_clear() new_threadstate() tstate_delete_common() Otherwise we end up breaking a constraint on free-threaded builds. Co-authored-by: RUANG (James Roy) longjinyii@outlook.com Issue: gh-114940

Open Graph Description: The new lock may be used instead of the global "HEAD" lock. That global lock guards the list of interpreters, but unfortunately in some situations (like for interp->threads.head) it ha...

X Description: The new lock may be used instead of the global "HEAD" lock. That global lock guards the list of interpreters, but unfortunately in some situations (like for interp->threads...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:0d05d459-dd3c-f34f-bbb1-0423def9744d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB884:2A2344:BEA5F0:1032558:6A57E677
html-safe-nonce77f9afc6ca57fd43fc02d9a284930bd5780d32cb37e329e3d9b555723344dbf1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODg0OjJBMjM0NDpCRUE1RjA6MTAzMjU1ODo2QTU3RTY3NyIsInZpc2l0b3JfaWQiOiIxMzAxMjQ2MDE1ODE5OTk4ODM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3dbb5eb149f99779663aff40d81ba53249e868530bf2c560d81587092bac8d10
hovercard-subject-tagpull_request:2192913069
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///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/127115/files
twitter:imagehttps://avatars.githubusercontent.com/u/1152074?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1152074?s=400&v=4
og:image:altThe new lock may be used instead of the global "HEAD" lock. That global lock guards the list of interpreters, but unfortunately in some situations (like for interp->threads.head) it ha...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None49c8c15fabcbf356d607a90ca115c13b273e42ff8b74155de050fd229a9b0121
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release72a32c9d47294b6b7eb7f0250253277920c7a987
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/127115/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F127115%2Ffiles
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%2F127115%2Ffiles
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%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/127115/files
Reloadhttps://github.com/python/cpython/pull/127115/files
Reloadhttps://github.com/python/cpython/pull/127115/files
Please reload this pagehttps://github.com/python/cpython/pull/127115/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/127115/files
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
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
ericsnowcurrentlyhttps://github.com/ericsnowcurrently
python:mainhttps://github.com/python/cpython/tree/main
ericsnowcurrently:interp-threads-lock-2https://github.com/ericsnowcurrently/cpython/tree/interp-threads-lock-2
Conversation 3 https://github.com/python/cpython/pull/127115
Commits 5 https://github.com/python/cpython/pull/127115/commits
Checks 0 https://github.com/python/cpython/pull/127115/checks
Files changed https://github.com/python/cpython/pull/127115/files
Please reload this pagehttps://github.com/python/cpython/pull/127115/files
gh-114940: Add a Per-Interpreter Lock For the List of Thread States https://github.com/python/cpython/pull/127115/files#top
Show all changes 5 commits https://github.com/python/cpython/pull/127115/files
74ae6de Add PyInterpreterState.threads.mutex. ericsnowcurrently Nov 20, 2024 https://github.com/python/cpython/pull/127115/commits/74ae6dec333924bbab8dbfa86dafbd77474bafa9
af6c962 Switch to _Py_FOR_EACH_TSTATE_BEGIN() where possible. ericsnowcurrently Nov 20, 2024 https://github.com/python/cpython/pull/127115/commits/af6c962809dbec2a4733b15eb4361e4e431f7246
db6269e Keep using the "head" lock where appropriate. ericsnowcurrently Nov 20, 2024 https://github.com/python/cpython/pull/127115/commits/db6269e6285e0d9927dc9c33edee235fafc2a0d2
d1c7c69 Reinit the new lock upon fork. ericsnowcurrently Nov 21, 2024 https://github.com/python/cpython/pull/127115/commits/d1c7c69238651a79e9c3d180a6d69b90f0779895
a99bfef Use a recursive lock. ericsnowcurrently Nov 21, 2024 https://github.com/python/cpython/pull/127115/commits/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9
Clear filters https://github.com/python/cpython/pull/127115/files
Please reload this pagehttps://github.com/python/cpython/pull/127115/files
Please reload this pagehttps://github.com/python/cpython/pull/127115/files
pycore_interp.h https://github.com/python/cpython/pull/127115/files#diff-cb06b7ba43789a1d6ae5bef46baa8a255b72dbcd2b44bfec7f146ea4e94dbfa0
pycore_lock.h https://github.com/python/cpython/pull/127115/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
pycore_pystate.h https://github.com/python/cpython/pull/127115/files#diff-76818a128869986e3de4f16dae0257c430008546f04764cd7ad8254abfa5ce83
pycore_runtime.h https://github.com/python/cpython/pull/127115/files#diff-004269ce4e6ea86068fb11d8ad53fc4321b693e991e9f847b43d0ecf97482862
posixmodule.c https://github.com/python/cpython/pull/127115/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
object.c https://github.com/python/cpython/pull/127115/files#diff-ba56d44ce0dd731d979970b966fde9d8dd15d12a82f727a052a8ad48d4a49363
obmalloc.c https://github.com/python/cpython/pull/127115/files#diff-399a22135f328b4e42b0722ef216587945eedf2d8c103a584a3dca5b30650329
gc_free_threading.c https://github.com/python/cpython/pull/127115/files#diff-4722ae850a2da3e12f50815c0e3932627ebe67edeaa8b7f28a94f20c8698204d
pystate.c https://github.com/python/cpython/pull/127115/files#diff-7ac11e526f79b42d6ea9d3592cb99da46775640c69fa5510f4a6de87cced7141
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L327
Include/internal/pycore_interp.hhttps://github.com/python/cpython/pull/127115/files#diff-cb06b7ba43789a1d6ae5bef46baa8a255b72dbcd2b44bfec7f146ea4e94dbfa0
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Include/internal/pycore_interp.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-cb06b7ba43789a1d6ae5bef46baa8a255b72dbcd2b44bfec7f146ea4e94dbfa0
https://github.com/python/cpython/pull/127115/files#diff-cb06b7ba43789a1d6ae5bef46baa8a255b72dbcd2b44bfec7f146ea4e94dbfa0
Include/internal/pycore_lock.hhttps://github.com/python/cpython/pull/127115/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Include/internal/pycore_lock.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
https://github.com/python/cpython/pull/127115/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
https://github.com/python/cpython/pull/127115/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L321
Include/internal/pycore_pystate.hhttps://github.com/python/cpython/pull/127115/files#diff-76818a128869986e3de4f16dae0257c430008546f04764cd7ad8254abfa5ce83
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Include/internal/pycore_pystate.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-76818a128869986e3de4f16dae0257c430008546f04764cd7ad8254abfa5ce83
https://github.com/python/cpython/pull/127115/files#diff-76818a128869986e3de4f16dae0257c430008546f04764cd7ad8254abfa5ce83
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L330
Include/internal/pycore_runtime.hhttps://github.com/python/cpython/pull/127115/files#diff-004269ce4e6ea86068fb11d8ad53fc4321b693e991e9f847b43d0ecf97482862
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Include/internal/pycore_runtime.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-004269ce4e6ea86068fb11d8ad53fc4321b693e991e9f847b43d0ecf97482862
https://github.com/python/cpython/pull/127115/files#diff-004269ce4e6ea86068fb11d8ad53fc4321b693e991e9f847b43d0ecf97482862
Modules/posixmodule.chttps://github.com/python/cpython/pull/127115/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Modules/posixmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/127115/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/127115/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L218
Objects/object.chttps://github.com/python/cpython/pull/127115/files#diff-ba56d44ce0dd731d979970b966fde9d8dd15d12a82f727a052a8ad48d4a49363
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Objects/object.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-ba56d44ce0dd731d979970b966fde9d8dd15d12a82f727a052a8ad48d4a49363
https://github.com/python/cpython/pull/127115/files#diff-ba56d44ce0dd731d979970b966fde9d8dd15d12a82f727a052a8ad48d4a49363
https://github.com/python/cpython/pull/127115/files#diff-ba56d44ce0dd731d979970b966fde9d8dd15d12a82f727a052a8ad48d4a49363
https://github.com/python/cpython/pull/127115/files#diff-ba56d44ce0dd731d979970b966fde9d8dd15d12a82f727a052a8ad48d4a49363
Objects/obmalloc.chttps://github.com/python/cpython/pull/127115/files#diff-399a22135f328b4e42b0722ef216587945eedf2d8c103a584a3dca5b30650329
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Objects/obmalloc.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-399a22135f328b4e42b0722ef216587945eedf2d8c103a584a3dca5b30650329
https://github.com/python/cpython/pull/127115/files#diff-399a22135f328b4e42b0722ef216587945eedf2d8c103a584a3dca5b30650329
Python/gc_free_threading.chttps://github.com/python/cpython/pull/127115/files#diff-4722ae850a2da3e12f50815c0e3932627ebe67edeaa8b7f28a94f20c8698204d
View file https://github.com/python/cpython/blob/a99bfef92ab6ebd29ba476d62674d1e4dd9657a9/Python/gc_free_threading.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/127115/{{ revealButtonHref }}
https://github.com/python/cpython/pull/127115/files#diff-4722ae850a2da3e12f50815c0e3932627ebe67edeaa8b7f28a94f20c8698204d
https://github.com/python/cpython/pull/127115/files#diff-4722ae850a2da3e12f50815c0e3932627ebe67edeaa8b7f28a94f20c8698204d
https://github.com/python/cpython/pull/127115/files#diff-4722ae850a2da3e12f50815c0e3932627ebe67edeaa8b7f28a94f20c8698204d
Please reload this pagehttps://github.com/python/cpython/pull/127115/files
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.