René's URL Explorer Experiment


Title: Concurrent partial.__setstate__() can free args during flattening · Issue #157099 · python/cpython · GitHub

Open Graph Title: Concurrent partial.__setstate__() can free args during flattening · Issue #157099 · python/cpython

X Title: Concurrent partial.__setstate__() can free args during flattening · Issue #157099 · python/cpython

Description: Description functools.partial.__setstate__() independently replaces fn, args, kw, dict, phcount, and vectorcall without a critical section. partial_new(), partial_call(), and partial_vectorcall() read these fields and borrow tuple items ...

Open Graph Description: Description functools.partial.__setstate__() independently replaces fn, args, kw, dict, phcount, and vectorcall without a critical section. partial_new(), partial_call(), and partial_vectorcall() r...

X Description: Description functools.partial.__setstate__() independently replaces fn, args, kw, dict, phcount, and vectorcall without a critical section. partial_new(), partial_call(), and partial_vectorcall() r...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Concurrent partial.__setstate__() can free args during flattening","articleBody":"**Description**\n\n`functools.partial.__setstate__()` independently replaces `fn`, `args`, `kw`, `dict`, `phcount`, and `vectorcall` without a critical section. `partial_new()`, `partial_call()`, and `partial_vectorcall()` read these fields and borrow tuple items without taking owned references to one coherent state. A setter can therefore release the old args tuple while another thread concatenates or indexes it, and readers can observe mixed state from different replacements.\n\n**Observed Behavior**\n\nOne thread repeatedly installed fresh valid states while seven threads called the partial and flattened it into another partial. The free-threaded ASan build crashed after 0.6 seconds in `tuple_concat()` from `partial_new()` at `Modules/_functoolsmodule.c:287`. The same executable completed 340,357 call/construction cycles in eight seconds with the GIL enabled.\n\n**Affected Version**\n\nCPython 3.14.7 at commit `823f0323ee6ec1402088b73bce1a38473cac36dc`, tested with a free-threaded ASan build.\n\n**Reproduction**\n\n```sh\nASAN_OPTIONS=abort_on_error=1:detect_leaks=0 PYTHON_GIL=0 python3.14 poc/reproduce.py 10\n```\n\nSetting `PYTHON_GIL=1` provides the GIL-enabled control.\n\n**PoC Source Code**\n\n`poc/reproduce.py`\n\n```python\nimport functools\nimport sys\nimport threading\nimport time\n\n\nclass Payload:\n    __slots__ = (\"data\",)\n\n    def __init__(self):\n        self.data = bytearray(8192)\n\n\ndef target_a(*args, **kwargs):\n    return len(args)\n\n\ndef target_b(*args, **kwargs):\n    return len(kwargs)\n\n\ndef fresh_state(turn):\n    func = target_a if turn & 1 else target_b\n    args = tuple(Payload() for _ in range(96))\n    return (func, args, {}, None)\n\n\nduration = float(sys.argv[1]) if len(sys.argv) > 1 else 10.0\nshared = functools.partial(target_a, *fresh_state(1)[1])\nstop = threading.Event()\ncounts = [0] * 7\n\n\ndef mutate():\n    turn = 0\n    while not stop.is_set():\n        shared.__setstate__(fresh_state(turn))\n        turn += 1\n\n\ndef exercise(slot):\n    while not stop.is_set():\n        try:\n            shared()\n            functools.partial(shared, Payload())\n            counts[slot] += 1\n        except (TypeError, ValueError):\n            pass\n\n\nthreads = [threading.Thread(target=mutate)]\nthreads.extend(threading.Thread(target=exercise, args=(i,)) for i in range(7))\nfor thread in threads:\n    thread.start()\ntime.sleep(duration)\nstop.set()\nfor thread in threads:\n    thread.join()\nprint(\"completed\", sum(counts))\n```\n","author":{"url":"https://github.com/Nievesjyl","@type":"Person","name":"Nievesjyl"},"datePublished":"2026-09-07T18:11:04Z","url":"https://github.com/python/cpython/issues/157099"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:937e314e-4888-8aa3-1e99-b6aa3812b0db
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD94E:535A8:601E78:84927C:6AF85B1F
html-safe-nonce7a36e96cfb3b9caa9909b78ca62d3dfbcd495d6a0ee9c2ff94e7b9c49506b5d4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTRFOjUzNUE4OjYwMUU3ODo4NDkyN0M6NkFGODVCMUYiLCJ2aXNpdG9yX2lkIjoiNzc2MjU0MjIwNjg3ODUwNTc1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf96c8a5b9cdb754f694a6b9c65542ccdfed56600b55715a82923140aeb0a1f18
hovercard-subject-tagissue:5377842085
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/157099/issue_layout
twitter:imagehttps://opengraph.githubassets.com/991e9bfa0cab37a707cf77cb28edd24688697f9ca48e71bc9c13016be486b44e/python/cpython/issues/157099
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/991e9bfa0cab37a707cf77cb28edd24688697f9ca48e71bc9c13016be486b44e/python/cpython/issues/157099
og:image:altDescription functools.partial.__setstate__() independently replaces fn, args, kw, dict, phcount, and vectorcall without a critical section. partial_new(), partial_call(), and partial_vectorcall() r...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameNievesjyl
hostnamegithub.com
expected-hostnamegithub.com
None5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db
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
release653be32ff5c755082a4db662491bfbbcfc9112c1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/157099#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F157099
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%2F157099
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/157099
Reloadhttps://github.com/python/cpython/issues/157099
Reloadhttps://github.com/python/cpython/issues/157099
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/pulse
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/157099
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/157099
Concurrent partial.__setstate__() can free args during flatteninghttps://github.com/python/cpython/issues/157099#top
https://github.com/Nievesjyl
Nievesjylhttps://github.com/Nievesjyl
on Sep 7, 2026https://github.com/python/cpython/issues/157099#issue-5377842085
https://github.com/ZeroIntensity
ZeroIntensityhttps://github.com/ZeroIntensity
on Sep 7, 2026https://github.com/python/cpython/issues/157099#issuecomment-5574619413
#157124 (comment)https://github.com/python/cpython/issues/157124#issuecomment-5574598280
ZeroIntensityhttps://github.com/ZeroIntensity
not plannedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Sep 7, 2026https://github.com/python/cpython/issues/157099#event-30709538039
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/157099
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/157099
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.