René's URL Explorer Experiment


Title: Race in ctypes PyCFuncPtr_new under free-threading · Issue #128567 · python/cpython · GitHub

Open Graph Title: Race in ctypes PyCFuncPtr_new under free-threading · Issue #128567 · python/cpython

X Title: Race in ctypes PyCFuncPtr_new under free-threading · Issue #128567 · python/cpython

Description: Bug report Bug description: I built cpython (3.13 branch) with free-threading and TSAN. The following python code reports TSAN warnings: import ctypes import concurrent.futures import threading def raw_func(x): pass def test_ctypes(): de...

Open Graph Description: Bug report Bug description: I built cpython (3.13 branch) with free-threading and TSAN. The following python code reports TSAN warnings: import ctypes import concurrent.futures import threading def...

X Description: Bug report Bug description: I built cpython (3.13 branch) with free-threading and TSAN. The following python code reports TSAN warnings: import ctypes import concurrent.futures import threading def...

Opengraph URL: https://github.com/python/cpython/issues/128567

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Race in ctypes PyCFuncPtr_new under free-threading  ","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nI built cpython (3.13 branch) with free-threading and TSAN. The following python code reports TSAN warnings:\r\n```python\r\nimport ctypes\r\nimport concurrent.futures\r\nimport threading\r\n\r\n\r\ndef raw_func(x):\r\n    pass\r\n\r\n\r\ndef test_ctypes():\r\n    def lookup():\r\n        prototype = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\r\n        return prototype(raw_func)\r\n\r\n    ctypes_args = ()\r\n    func = lookup()\r\n    packed_args = (ctypes.c_void_p * len(ctypes_args))()\r\n    for argNum in range(len(ctypes_args)):\r\n        packed_args[argNum] = ctypes.cast(ctypes_args[argNum], ctypes.c_void_p)\r\n    func(packed_args)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    num_workers = 20\r\n\r\n    barrier = threading.Barrier(num_workers)\r\n\r\n    def closure():\r\n        barrier.wait()\r\n        test_ctypes()\r\n\r\n    with concurrent.futures.ThreadPoolExecutor(max_workers=num_workers) as executor:\r\n        futures = []\r\n        for i in range(num_workers):\r\n            futures.append(executor.submit(closure))\r\n        assert len(list(f.result() for f in futures)) == num_workers\r\n\r\n```\r\nTSAN report extract:\r\n```\r\nWARNING: ThreadSanitizer: data race (pid=261974)\r\n  Write of size 4 at 0x7fffbe0d0430 by thread T5:\r\n    #0 generic_pycdata_new /project/cpython/./Modules/_ctypes/_ctypes.c:3387:17 (_ctypes.cpython-313t-x86_64-linux-gnu.so+0xdbb7) (BuildId: 6a7727f376cee83a3124898fe6eb84e45e3a54bc)\r\n    #1 PyCFuncPtr_new /project/cpython/./Modules/_ctypes/_ctypes.c:3963:32 (_ctypes.cpython-313t-x86_64-linux-gnu.so+0x18bbb) (BuildId: 6a7727f376cee83a3124898fe6eb84e45e3a54bc)\r\n    #2 type_call /project/cpython/Objects/typeobject.c:1981:11 (python3.13t+0x2eb032) (BuildId: 65e52348ca9319985f9f5e265fd43aab2c867d59)\r\n    #3 _PyObject_MakeTpCall /project/cpython/Objects/call.c:242:18 (python3.13t+0x1ea44c) (BuildId: 65e52348ca9319985f9f5e265fd43aab2c867d59)\r\n    #4 _PyObject_VectorcallTstate /project/cpython/./Include/internal/pycore_call.h:166:16 (python3.13t+0x1eb0a8) (BuildId: 65e52348ca9319985f9f5e265fd43aab2c867d59)\r\n    #5 PyObject_Vectorcall /project/cpython/Objects/call.c:327:12 (python3.13t+0x1eb0a8)\r\n```\r\n\r\n[Full traceback](https://gist.github.com/vfdev-5/94ac799fddf453dc8d7186024861ccb7)\r\n \r\n\r\nRelated https://github.com/python/cpython/issues/128182\r\n\r\n\r\n\r\n### CPython versions tested on:\r\n\r\n3.13\r\n\r\n### Operating systems tested on:\r\n\r\nLinux","author":{"url":"https://github.com/vfdev-5","@type":"Person","name":"vfdev-5"},"datePublished":"2025-01-07T01:31:43Z","url":"https://github.com/python/cpython/issues/128567"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fd67c8ab-5317-1eee-f230-dcb726478339
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD16A:14EB6E:1BDA60A:248E494:6B021B62
html-safe-nonce4df57e4a2a1c69df05fc65ff549982eeb26a695925634c6cffff2a5ade52ecda
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTZBOjE0RUI2RToxQkRBNjBBOjI0OEU0OTQ6NkIwMjFCNjIiLCJ2aXNpdG9yX2lkIjoiNzkwMzc1OTUyNzE4OTM0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaceb187daa32ac02fa0c9782923601e8797621dc69a325ea6dd4bad4ee520f9a91
hovercard-subject-tagissue:2771719080
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/128567/issue_layout
twitter:imagehttps://opengraph.githubassets.com/036bbc218f5395d180bbc3abe51e555be2bcb164bca785864049d7ba6b760df0/python/cpython/issues/128567
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/036bbc218f5395d180bbc3abe51e555be2bcb164bca785864049d7ba6b760df0/python/cpython/issues/128567
og:image:altBug report Bug description: I built cpython (3.13 branch) with free-threading and TSAN. The following python code reports TSAN warnings: import ctypes import concurrent.futures import threading def...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevfdev-5
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/128567#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F128567
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F128567
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/128567
Reloadhttps://github.com/python/cpython/issues/128567
Reloadhttps://github.com/python/cpython/issues/128567
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/128567
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/128567
#131716https://github.com/python/cpython/pull/131716
Race in ctypes PyCFuncPtr_new under free-threading https://github.com/python/cpython/issues/128567#top
#131716https://github.com/python/cpython/pull/131716
https://github.com/kumaraditya303
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/vfdev-5
vfdev-5https://github.com/vfdev-5
on Jan 7, 2025https://github.com/python/cpython/issues/128567#issue-2771719080
Full tracebackhttps://gist.github.com/vfdev-5/94ac799fddf453dc8d7186024861ccb7
#128182https://github.com/python/cpython/issues/128182
vfdev-5https://github.com/vfdev-5
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jan 7, 2025https://github.com/python/cpython/issues/128567#event-15832570630
ZeroIntensityhttps://github.com/ZeroIntensity
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
on Jan 7, 2025https://github.com/python/cpython/issues/128567#event-15832646154
https://github.com/ZeroIntensity
ZeroIntensityhttps://github.com/ZeroIntensity
on Jan 7, 2025https://github.com/python/cpython/issues/128567#issuecomment-2574244698
https://github.com/vfdev-5
vfdev-5https://github.com/vfdev-5
on Jan 7, 2025https://github.com/python/cpython/issues/128567#issuecomment-2574255943
kumaraditya303https://github.com/kumaraditya303
on Mar 24, 2025https://github.com/python/cpython/issues/128567#event-16955253958
kumaraditya303https://github.com/kumaraditya303
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#131716https://github.com/python/cpython/pull/131716
on Mar 30, 2025https://github.com/python/cpython/issues/128567#event-17047491435
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/128567
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/128567
kumaraditya303https://github.com/kumaraditya303
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
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.