René's URL Explorer Experiment


Title: gh-127266: avoid data races when updating type slots v2 by nascheme · Pull Request #133177 · python/cpython · GitHub

Open Graph Title: gh-127266: avoid data races when updating type slots v2 by nascheme · Pull Request #133177 · python/cpython

X Title: gh-127266: avoid data races when updating type slots v2 by nascheme · Pull Request #133177 · python/cpython

Description: This is an updated version of GH-131174, which was reverted. I figured the cleanest thing to do is make a new PR. This is the same as the previous PR with the following additional change. The update_all_slots() and type_setattro() functions are now more careful when the world is stopped. Instead of doing the MRO lookups while the world is stopped, we do them all first and collect the slot pointers to be updated. Then, we stop the world and do those updates. This makes it much easier to confirm the code running during the stop-the-world is safe and that should avoid the deadlocks. The test_opcache test has become quite a bit slower. It seems to be due to mutex contention in the __getitem__ and __getattribute__ method assignment tests. I reduced the items count from 1000 to 100 to keep the test from becoming much slower. Issue: gh-127266

Open Graph Description: This is an updated version of GH-131174, which was reverted. I figured the cleanest thing to do is make a new PR. This is the same as the previous PR with the following additional change. The upda...

X Description: This is an updated version of GH-131174, which was reverted. I figured the cleanest thing to do is make a new PR. This is the same as the previous PR with the following additional change. The upda...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:82451492-426d-63a7-11e7-3cbc67223e9b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9F6E:28BD80:5121AC:6C5CBF:6A5595FA
html-safe-nonce07e4acb30714c9873103a321c20e6355fa908932c1253df10499d18658911efe
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjZFOjI4QkQ4MDo1MTIxQUM6NkM1Q0JGOjZBNTU5NUZBIiwidmlzaXRvcl9pZCI6IjI4MzYzMzczMjEzNjgzNDU1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacbec9ba454a2e6531fce9c3d8720efa85329c117487093996d5cb998c4c9620f1
hovercard-subject-tagpull_request:2490131491
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/133177/files
twitter:imagehttps://avatars.githubusercontent.com/u/690853?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/690853?s=400&v=4
og:image:altThis is an updated version of GH-131174, which was reverted. I figured the cleanest thing to do is make a new PR. This is the same as the previous PR with the following additional change. The upda...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e
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
releaseaa21baa44893467b0b640d0300538f84ca8c475b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/133177/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F133177%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%2F133177%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/133177/files
Reloadhttps://github.com/python/cpython/pull/133177/files
Reloadhttps://github.com/python/cpython/pull/133177/files
Please reload this pagehttps://github.com/python/cpython/pull/133177/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/133177/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
naschemehttps://github.com/nascheme
python:mainhttps://github.com/python/cpython/tree/main
nascheme:type-slot-ts-v2https://github.com/nascheme/cpython/tree/type-slot-ts-v2
Conversation 18 https://github.com/python/cpython/pull/133177
Commits 24 https://github.com/python/cpython/pull/133177/commits
Checks 0 https://github.com/python/cpython/pull/133177/checks
Files changed https://github.com/python/cpython/pull/133177/files
Please reload this pagehttps://github.com/python/cpython/pull/133177/files
gh-127266: avoid data races when updating type slots v2 https://github.com/python/cpython/pull/133177/files#top
Show all changes 24 commits https://github.com/python/cpython/pull/133177/files
3094372 gh-127266: avoid data races when updating type slots nascheme Apr 29, 2025 https://github.com/python/cpython/pull/133177/commits/3094372e5fc8725c7de13479e4df7a0e6479fc44
f447ce4 For update_all_slots(), do updates more safely. nascheme Apr 29, 2025 https://github.com/python/cpython/pull/133177/commits/f447ce4adf750b9da15011e30eaf8aee3fd7b478
d511ca6 Avoid "empty structure" compile error. nascheme Apr 29, 2025 https://github.com/python/cpython/pull/133177/commits/d511ca6015e8a95c4f0f8c76330a8b57e3e1060c
5e38497 Use apply_slot_updates() for type_setattro(). nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/5e38497b323fdb828d61a0a965841f07086edbcc
e9516c7 Merge 'origin/main' into type-slot-ts-v2 nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/e9516c7a7685f2bd73d005af9a69ab6c52a7a5a2
8c74a0c Reduce number of items in test for slot updates. nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/8c74a0c2e29ca8d4afadca8346eed685811943ca
6cd7644 Add TSAN suppression for _Py_slot_tp_getattr_hook. nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/6cd7644c99c2980c9f054d6bd77b2d8e39cb0dee
3cb2256 Queue update of tp_flags as well. nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/3cb225610df2ff9c89b6ec7a27bfc630a1420939
47e41c9 Performance, skip stop-the-world when possible. nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/47e41c9896587cbfc5a9c6ad5d37a5b95cf16051
cb848f1 Merge 'origin/main' into type-slot-ts-v2 nascheme Apr 30, 2025 https://github.com/python/cpython/pull/133177/commits/cb848f117b0145b386d8f1b4fbc8710248456203
9859ebf Always clear version after __bases__ update. nascheme May 1, 2025 https://github.com/python/cpython/pull/133177/commits/9859ebf50986977b116d58f98ae81b054f04844c
6c74cac Merge 'origin/main' into type-slot-ts-v2 nascheme May 1, 2025 https://github.com/python/cpython/pull/133177/commits/6c74cacf2162924f82552c414f1300d0d12c7be0
583c435 Add test for assigning __bases__. nascheme May 1, 2025 https://github.com/python/cpython/pull/133177/commits/583c435df6179ba6675fa3274bab6bfcfbcf9862
c01707e Avoid releasing TYPE_LOCK when stopping the world. nascheme May 1, 2025 https://github.com/python/cpython/pull/133177/commits/c01707e839116fb0a87d82ac6d66d1c288888d47
1b9cad5 Merge 'origin/main' into type-slot-ts-v2 nascheme May 5, 2025 https://github.com/python/cpython/pull/133177/commits/1b9cad59500bd967c26d8145b911c91e954860d7
a1c6b05 Add issue number for TSAN suppression. nascheme May 5, 2025 https://github.com/python/cpython/pull/133177/commits/a1c6b054e8a73fa658a37fa6431621b058575d9f
3f6222b Bug fix for type_lock_prevent_release(). nascheme May 5, 2025 https://github.com/python/cpython/pull/133177/commits/3f6222b70eb3751ff309f9a56d5cbae92b1ac6b9
6f218fb Merge 'origin/main' into type-slot-ts-v2 nascheme May 8, 2025 https://github.com/python/cpython/pull/133177/commits/6f218fb5ced903a936a5f447f89ced776a496331
2bcf7ba Add additional assert. nascheme May 27, 2025 https://github.com/python/cpython/pull/133177/commits/2bcf7ba6329f54d4162e5444c5f313c9d3cf304e
ddfdbd5 Merge 'origin/main' into type-slot-ts-v2 nascheme May 27, 2025 https://github.com/python/cpython/pull/133177/commits/ddfdbd5467dedb89268e752cf099369a25fe54c6
63b7ae4 Revert test_opcache item size change. nascheme May 27, 2025 https://github.com/python/cpython/pull/133177/commits/63b7ae41c3b088f9de780c0a1fcd4b8445994374
1a2fee1 Add comment for new unit test. nascheme May 27, 2025 https://github.com/python/cpython/pull/133177/commits/1a2fee1048b292f9b30d491f2cb3d313b9976b7c
c1f3ed5 Fix assert for default build. nascheme May 27, 2025 https://github.com/python/cpython/pull/133177/commits/c1f3ed56a21d93d2c66dddfd2268628ab91be715
41e54e1 Improve function name. nascheme May 27, 2025 https://github.com/python/cpython/pull/133177/commits/41e54e11fe92821ff1985ea1564f98c1f5a1b752
Clear filters https://github.com/python/cpython/pull/133177/files
Please reload this pagehttps://github.com/python/cpython/pull/133177/files
Please reload this pagehttps://github.com/python/cpython/pull/133177/files
pycore_interp_structs.h https://github.com/python/cpython/pull/133177/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
pycore_object.h https://github.com/python/cpython/pull/133177/files#diff-2a12f738a77b362d74a65949b58c37f2affcd15ba8b1c979b63bd00223b8a456
pycore_typeobject.h https://github.com/python/cpython/pull/133177/files#diff-9df981eafa9c743230f2e1513191ba147f0fba63d0c51fb7968c1e7093d9e877
object.h https://github.com/python/cpython/pull/133177/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
refcount.h https://github.com/python/cpython/pull/133177/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
test_descr.py https://github.com/python/cpython/pull/133177/files#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b
2025-03-14-13-08-20.gh-issue-127266._tyfBp.rst https://github.com/python/cpython/pull/133177/files#diff-0c76f728f1804f73e9803de65856995503deb1b9574137ae77eea74ed73a7592
typeobject.c https://github.com/python/cpython/pull/133177/files#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
ceval.c https://github.com/python/cpython/pull/133177/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59de
suppressions_free_threading.txt https://github.com/python/cpython/pull/133177/files#diff-e0bd286d26ab448230ebe522b9086f5e93c33327108faff3a3957a34bb605f62
Include/internal/pycore_interp_structs.hhttps://github.com/python/cpython/pull/133177/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Include/internal/pycore_interp_structs.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
https://github.com/python/cpython/pull/133177/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
https://github.com/python/cpython/pull/133177/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
Include/internal/pycore_object.hhttps://github.com/python/cpython/pull/133177/files#diff-2a12f738a77b362d74a65949b58c37f2affcd15ba8b1c979b63bd00223b8a456
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Include/internal/pycore_object.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
https://github.com/python/cpython/pull/133177/files#diff-2a12f738a77b362d74a65949b58c37f2affcd15ba8b1c979b63bd00223b8a456
https://github.com/python/cpython/pull/133177/files#diff-2a12f738a77b362d74a65949b58c37f2affcd15ba8b1c979b63bd00223b8a456
Include/internal/pycore_typeobject.hhttps://github.com/python/cpython/pull/133177/files#diff-9df981eafa9c743230f2e1513191ba147f0fba63d0c51fb7968c1e7093d9e877
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Include/internal/pycore_typeobject.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
https://github.com/python/cpython/pull/133177/files#diff-9df981eafa9c743230f2e1513191ba147f0fba63d0c51fb7968c1e7093d9e877
https://github.com/python/cpython/pull/133177/files#diff-9df981eafa9c743230f2e1513191ba147f0fba63d0c51fb7968c1e7093d9e877
Include/object.hhttps://github.com/python/cpython/pull/133177/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Include/object.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
https://github.com/python/cpython/pull/133177/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/133177/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/133177/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
https://github.com/python/cpython/pull/133177/files#diff-87272721a5cf1cd9915d6f503f6a7bbefa2f26c935c7ce83ca78706afd0ad05a
Include/refcount.hhttps://github.com/python/cpython/pull/133177/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Include/refcount.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
https://github.com/python/cpython/pull/133177/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
https://github.com/python/cpython/pull/133177/files#diff-586c6481df97b64cf94363854b92d8e896f8b969f9f160fdb69ba0eae3cdc987
Lib/test/test_descr.pyhttps://github.com/python/cpython/pull/133177/files#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Lib/test/test_descr.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
https://github.com/python/cpython/pull/133177/files#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b
https://github.com/python/cpython/pull/133177/files#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b
Misc/NEWS.d/next/Core_and_Builtins/2025-03-14-13-08-20.gh-issue-127266._tyfBp.rsthttps://github.com/python/cpython/pull/133177/files#diff-0c76f728f1804f73e9803de65856995503deb1b9574137ae77eea74ed73a7592
View file https://github.com/nascheme/cpython/blob/41e54e11fe92821ff1985ea1564f98c1f5a1b752/Misc/NEWS.d/next/Core_and_Builtins/2025-03-14-13-08-20.gh-issue-127266._tyfBp.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/133177/{{ revealButtonHref }}
Please reload this pagehttps://github.com/python/cpython/pull/133177/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.