René's URL Explorer Experiment


Title: gh-135871: Reload lock internal state while spinning in `PyMutex_LockTimed` by dpdani · Pull Request #146064 · python/cpython · GitHub

Open Graph Title: gh-135871: Reload lock internal state while spinning in `PyMutex_LockTimed` by dpdani · Pull Request #146064 · python/cpython

X Title: gh-135871: Reload lock internal state while spinning in `PyMutex_LockTimed` by dpdani · Pull Request #146064 · python/cpython

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

Open Graph Description: This PR adds atomic loads in the slow path of PyMutex to increase the number of lock acquisitions per second that threads can make on a shared mutex. The tricky part here is to avoid degrading the ...

X Description: This PR adds atomic loads in the slow path of PyMutex to increase the number of lock acquisitions per second that threads can make on a shared mutex. The tricky part here is to avoid degrading the ...

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

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:09bc9742-27cd-afaa-8fd3-e97d1e888a66
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE516:18EF1B:A88C63F:EB70BA4:6A50E6BC
html-safe-noncefc1abc99cc115464005b307f38d55d25e6de52bcfcba792c3c0eae78c444eb52
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTE2OjE4RUYxQjpBODhDNjNGOkVCNzBCQTQ6NkE1MEU2QkMiLCJ2aXNpdG9yX2lkIjoiNzAyMjQ3MTI0NjcyMjk1MDg0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc5a21696f83cdf1c00e3c9f84e7b9b28d7afb7af45b5c51cfda4d6bc2aa3f186
hovercard-subject-tagpull_request:3410155281
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/146064/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/0a743c8c50b6613a9d99bb35104dabf3174d2f743f4c8784206c9f32163437e2/python/cpython/pull/146064
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0a743c8c50b6613a9d99bb35104dabf3174d2f743f4c8784206c9f32163437e2/python/cpython/pull/146064
og:image:altThis PR adds atomic loads in the slow path of PyMutex to increase the number of lock acquisitions per second that threads can make on a shared mutex. The tricky part here is to avoid degrading the ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedpdani
hostnamegithub.com
expected-hostnamegithub.com
None72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0
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
releasefb19d617b534959801b4b7453938ecf1dfa22131
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/146064#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F146064
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%2F146064
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/146064
Reloadhttps://github.com/python/cpython/pull/146064
Reloadhttps://github.com/python/cpython/pull/146064
Please reload this pagehttps://github.com/python/cpython/pull/146064
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/146064
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
colesburyhttps://github.com/colesbury
python:mainhttps://github.com/python/cpython/tree/main
dpdani:pymutex-spinning-reloadhttps://github.com/dpdani/cpython/tree/pymutex-spinning-reload
Conversationhttps://github.com/python/cpython/pull/146064
Commits5 (5)https://github.com/python/cpython/pull/146064/commits
Checkshttps://github.com/python/cpython/pull/146064/checks
Files changedhttps://github.com/python/cpython/pull/146064/files
gh-135871: Reload lock internal state while spinning in PyMutex_LockTimedhttps://github.com/python/cpython/pull/146064#top
colesburyhttps://github.com/colesbury
python:mainhttps://github.com/python/cpython/tree/main
dpdani:pymutex-spinning-reloadhttps://github.com/dpdani/cpython/tree/pymutex-spinning-reload
https://github.com/dpdani
dpdanihttps://github.com/dpdani
Mar 17, 2026https://github.com/python/cpython/pull/146064#issue-4089230408
Please reload this pagehttps://github.com/python/cpython/pull/146064
lockbenchhttps://github.com/python/cpython/blob/main/Tools/lockbench/lockbench.py
@colesburyhttps://github.com/colesbury
https://private-user-images.githubusercontent.com/8658291/564867536-9e40ef43-75b0-4546-9ad3-fbfe077bff6b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM2ODcxNDQsIm5iZiI6MTc4MzY4Njg0NCwicGF0aCI6Ii84NjU4MjkxLzU2NDg2NzUzNi05ZTQwZWY0My03NWIwLTQ1NDYtOWFkMy1mYmZlMDc3YmZmNmIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MTBUMTIzNDA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2Y5YzllNGQ2N2YyYjRjMjU5NzQwZjBkYThiMGMzZGM0YjgwNDk3ZDcwMjFmMTk2NzM3ZWE4MGZjODg0NDVlYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.HR9anbMf8xsghnEidOD_Qvrhs_kglGl1_vv13d9-qkg
https://private-user-images.githubusercontent.com/8658291/564868686-8de69ec8-affb-4927-8b4d-a57614a73230.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM2ODcxNDQsIm5iZiI6MTc4MzY4Njg0NCwicGF0aCI6Ii84NjU4MjkxLzU2NDg2ODY4Ni04ZGU2OWVjOC1hZmZiLTQ5MjctOGI0ZC1hNTc2MTRhNzMyMzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MTBUMTIzNDA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjVkYWYwOTJiMmJlN2UwMjlkZTc1MzI1YTk3MmJiOGM3ZjU5YmRkN2Q5ZDdmZWI2OGY1MzNiNWI2ZTVmNGY5OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.DnnG_m_elrL--KfF_7UjJU5KWyfRiI29v76hB1oqM94
Non-blocking _PyMutex_LockTimed spins and may fail unnecessarily in no-GIL builds #135871https://github.com/python/cpython/issues/135871
Please reload this pagehttps://github.com/python/cpython/pull/146064
https://github.com/dpdani
pythongh-135871https://github.com/python/cpython/issues/135871
: Reload lock internal state while spinning in `_PyMut…https://github.com/python/cpython/pull/146064/commits/7217ad07daa0a404fcf4452d8cf44fabb2b7c1de
7217ad0https://github.com/python/cpython/pull/146064/commits/7217ad07daa0a404fcf4452d8cf44fabb2b7c1de
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
Mar 17, 2026 https://github.com/python/cpython/pull/146064#ref-issue-3169847353
Non-blocking _PyMutex_LockTimed spins and may fail unnecessarily in no-GIL builds #135871 https://github.com/python/cpython/issues/135871
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20review%22
Mar 17, 2026https://github.com/python/cpython/pull/146064#event-23648123556
https://github.com/apps/blurb-it
📜🤖 Added by blurb_it.https://github.com/python/cpython/pull/146064/commits/54932d638bf3bbe0cac46b0acc1523f64d844307
54932d6https://github.com/python/cpython/pull/146064/commits/54932d638bf3bbe0cac46b0acc1523f64d844307
https://github.com/diegorusso
diegorussohttps://github.com/diegorusso
topic-free-threading https://github.com/python/cpython/issues?q=state%3Aopen%20label%3Atopic-free-threading
Mar 23, 2026https://github.com/python/cpython/pull/146064#event-23814818139
https://github.com/diegorusso
diegorussohttps://github.com/diegorusso
colesburyhttps://github.com/colesbury
March 23, 2026 13:54https://github.com/python/cpython/pull/146064#event-23814853864
https://github.com/colesbury
colesburyhttps://github.com/colesbury
Mar 23, 2026 https://github.com/python/cpython/pull/146064#pullrequestreview-3992772762
View reviewed changes https://github.com/python/cpython/pull/146064/files/54932d638bf3bbe0cac46b0acc1523f64d844307
colesburyhttps://github.com/colesbury
https://github.com/python/cpython/pull/146064#pullrequestreview-3992772762
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/146064
Python/lock.chttps://github.com/python/cpython/pull/146064/files/54932d638bf3bbe0cac46b0acc1523f64d844307#diff-8a628e2db62193e1be26995ded4a1da56d11a156b4e9190984c910f1b019a962
Please reload this pagehttps://github.com/python/cpython/pull/146064
Python/lock.chttps://github.com/python/cpython/pull/146064/files/54932d638bf3bbe0cac46b0acc1523f64d844307#diff-8a628e2db62193e1be26995ded4a1da56d11a156b4e9190984c910f1b019a962
Please reload this pagehttps://github.com/python/cpython/pull/146064
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting merge https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20merge%22
awaiting review https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20review%22
Mar 23, 2026https://github.com/python/cpython/pull/146064#event-23819558849
dpdanihttps://github.com/dpdani
March 23, 2026 16:06https://github.com/python/cpython/pull/146064#commits-pushed-f1eaffa
https://github.com/dpdani
https://github.com/colesbury
parentheses for castinghttps://github.com/python/cpython/pull/146064/commits/f1eaffacc80ccc204e46fd8771e7ea67a9df2305
f1eaffahttps://github.com/python/cpython/pull/146064/commits/f1eaffacc80ccc204e46fd8771e7ea67a9df2305
https://github.com/dpdani
RELOAD_SPIN_COUNT -> RELOAD_SPIN_MASKhttps://github.com/python/cpython/pull/146064/commits/5fee9e4e0c484ae54fcb8474507ac6115bdc86da
5fee9e4https://github.com/python/cpython/pull/146064/commits/5fee9e4e0c484ae54fcb8474507ac6115bdc86da
https://github.com/colesbury
Merge branch 'main' into pymutex-spinning-reloadhttps://github.com/python/cpython/pull/146064/commits/e7b874e7b06d41cc1bae24b549cd4bc8798382f1
e7b874ehttps://github.com/python/cpython/pull/146064/commits/e7b874e7b06d41cc1bae24b549cd4bc8798382f1
https://github.com/colesbury
colesburyhttps://github.com/colesbury
daa159fhttps://github.com/python/cpython/commit/daa159f98b3689ae6a587bfb978b931762f9dbc9
Mar 23, 2026https://github.com/python/cpython/pull/146064#event-23828922585
Please reload this pagehttps://github.com/python/cpython/pull/146064
https://github.com/apps/bedevere-app
bedevere-apphttps://github.com/apps/bedevere-app
awaiting merge https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22awaiting%20merge%22
Mar 23, 2026https://github.com/python/cpython/pull/146064#event-23828924530
CuriousLearnerhttps://github.com/CuriousLearner
Mar 24, 2026 https://github.com/python/cpython/pull/146064#ref-commit-78b2c6a
https://github.com/CuriousLearner
Merge branch 'fix-https://github.com/CuriousLearner/cpython/commit/78b2c6a7708e1cb967f26f631a41ea294b7a6b14
pythongh-138577https://github.com/python/cpython/issues/138577
' of github.com:CuriousLearner/cpyth…https://github.com/CuriousLearner/cpython/commit/78b2c6a7708e1cb967f26f631a41ea294b7a6b14
78b2c6ahttps://github.com/CuriousLearner/cpython/commit/78b2c6a7708e1cb967f26f631a41ea294b7a6b14
pythongh-138577https://github.com/python/cpython/issues/138577
pythongh-138577https://github.com/python/cpython/issues/138577
pythongh-146202https://github.com/python/cpython/issues/146202
python#146347https://github.com/python/cpython/pull/146347
pythongh-144319https://github.com/python/cpython/issues/144319
python#144928https://github.com/python/cpython/pull/144928
pythongh-146199https://github.com/python/cpython/issues/146199
python#146200https://github.com/python/cpython/pull/146200
pythongh-146197https://github.com/python/cpython/issues/146197
python#146346https://github.com/python/cpython/pull/146346
pythongh-135871https://github.com/python/cpython/issues/135871
pythongh-146064https://github.com/python/cpython/pull/146064
pythongh-145719https://github.com/python/cpython/issues/145719
python#145720https://github.com/python/cpython/pull/145720
https://github.com/dpdani
dpdanihttps://github.com/dpdani
March 24, 2026 09:46https://github.com/python/cpython/pull/146064#event-23845164670
https://github.com/pablogsal
pablogsalhttps://github.com/pablogsal
Apr 4, 2026 https://github.com/python/cpython/pull/146064#ref-pullrequest-3716338400
gh-130273: Fix traceback color output with unicode characters #142529 https://github.com/python/cpython/pull/142529
clin1234https://github.com/clin1234
Apr 16, 2026 https://github.com/python/cpython/pull/146064#ref-commit-28b767f
https://github.com/dpdani
https://github.com/clin1234
pythongh-135871https://github.com/python/cpython/issues/135871
: Reload lock internal state while spinning in `PyMute…https://github.com/clin1234/cpython/commit/28b767fbcb56053ddc2cb2a2a290997e2dff3312
28b767fhttps://github.com/clin1234/cpython/commit/28b767fbcb56053ddc2cb2a2a290997e2dff3312
pythongh-146064https://github.com/python/cpython/pull/146064
ljfphttps://github.com/ljfp
Apr 25, 2026 https://github.com/python/cpython/pull/146064#ref-commit-29cb7de
https://github.com/dpdani
https://github.com/ljfp
pythongh-135871https://github.com/python/cpython/issues/135871
: Reload lock internal state while spinning in `PyMute…https://github.com/ljfp/cpython/commit/29cb7de4a9c58991d5af5edc85c6749b55c2f2c1
29cb7dehttps://github.com/ljfp/cpython/commit/29cb7de4a9c58991d5af5edc85c6749b55c2f2c1
pythongh-146064https://github.com/python/cpython/pull/146064
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%2F146064
https://github.com/colesbury
colesbury https://github.com/colesbury
https://github.com/python/cpython/pull/146064/files/54932d638bf3bbe0cac46b0acc1523f64d844307
topic-free-threading https://github.com/python/cpython/issues?q=state%3Aopen%20label%3Atopic-free-threading
Please reload this pagehttps://github.com/python/cpython/pull/146064
https://github.com/dpdani
https://github.com/colesbury
https://github.com/diegorusso
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.