René's URL Explorer Experiment


Title: Data race in `sys_set_flag` when `sys.set_int_max_str_digits()` is called concurrently with free-threaded build · Issue #151218 · python/cpython · GitHub

Open Graph Title: Data race in `sys_set_flag` when `sys.set_int_max_str_digits()` is called concurrently with free-threaded build · Issue #151218 · python/cpython

X Title: Data race in `sys_set_flag` when `sys.set_int_max_str_digits()` is called concurrently with free-threaded build · Issue #151218 · python/cpython

Description: Bug report Bug description: sys.set_int_max_str_digits() updates sys.flags via sys_set_flag(), which modifies a shared struct-sequence slot without synchronization: cpython/Python/sysmodule.c Lines 3479 to 3487 in ce916dc static void sys...

Open Graph Description: Bug report Bug description: sys.set_int_max_str_digits() updates sys.flags via sys_set_flag(), which modifies a shared struct-sequence slot without synchronization: cpython/Python/sysmodule.c Lines...

X Description: Bug report Bug description: sys.set_int_max_str_digits() updates sys.flags via sys_set_flag(), which modifies a shared struct-sequence slot without synchronization: cpython/Python/sysmodule.c Lines...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Data race in `sys_set_flag` when `sys.set_int_max_str_digits()` is called concurrently with free-threaded build","articleBody":"# Bug report\n\n### Bug description:\n\n`sys.set_int_max_str_digits()` updates `sys.flags` via `sys_set_flag()`, which modifies a shared struct-sequence slot without synchronization:\n\nhttps://github.com/python/cpython/blob/ce916dc50644bb1de940f5fb580bd9907cceb959/Python/sysmodule.c#L3479-L3487\n\nConcurrent callers race on the slot and can `Py_XDECREF` the same `old_value`, leading to a use-after-free of the old flag object.\n\nReproducer:\n```python\nimport sys\nfrom threading import Thread\n\ndef thread1():\n    for i in range (20000):\n        sys.set_int_max_str_digits(4300 + (i \u0026 7))\n\nthreads = [Thread(target=thread1) for _ in range(4)]\nfor t in threads: t.start()\nfor t in threads: t.join()\n```\n\nTSAN Report:\n```\n==================\nWARNING: ThreadSanitizer: data race (pid=1518581)\n  Read of size 8 at 0x7fffb63e01b8 by thread T1:\n    #0 PyStructSequence_GetItem /cpython/Objects/structseq.c:112:12  \n    #1 sys_set_flag /cpython/./Python/sysmodule.c:3484:27  \n    #2 _PySys_SetFlagObj /cpython/./Python/sysmodule.c:3498:5 \n    #3 _PySys_SetFlagInt /cpython/./Python/sysmodule.c:3512:15  \n    #4 _PySys_SetIntMaxStrDigits /cpython/./Python/sysmodule.c:4671:9 \n    #5 sys_set_int_max_str_digits_impl /cpython/./Python/sysmodule.c:1894:9  \n    #6 sys_set_int_max_str_digits /cpython/./Python/clinic/sysmodule.c.h:932:20 \n    #7 _Py_BuiltinCallFastWithKeywords_StackRef /cpython/Python/ceval.c:839:11  \n    #8 _PyEval_EvalFrameDefault /cpython/Python/generated_cases.c.h:2508:35 \n\n  Previous write of size 8 at 0x7fffb63e01b8 by thread T2:\n    #0 PyStructSequence_SetItem /cpython/Objects/structseq.c:100:27  \n    #1 sys_set_flag /cpython/./Python/sysmodule.c:3485:5  \n    #2 _PySys_SetFlagObj /cpython/./Python/sysmodule.c:3498:5 \n    #3 _PySys_SetFlagInt /cpython/./Python/sysmodule.c:3512:15  \n    #4 _PySys_SetIntMaxStrDigits /cpython/./Python/sysmodule.c:4671:9 \n    #5 sys_set_int_max_str_digits_impl /cpython/./Python/sysmodule.c:1894:9  \n    #6 sys_set_int_max_str_digits /cpython/./Python/clinic/sysmodule.c.h:932:20 \n    #7 cfunction_vectorcall_FASTCALL_KEYWORDS /cpython/Objects/methodobject.c:465:24  \n    #8 _PyObject_VectorcallTstate /cpython/./Include/internal/pycore_call.h:144:11  \n    #9 PyObject_Vectorcall /cpython/Objects/call.c:327:12\n...\nSUMMARY: ThreadSanitizer: data race /cpython/Objects/structseq.c:112:12 in PyStructSequence_GetItem\n==================\n==================\nWARNING: ThreadSanitizer: data race (pid=1518581)\n  Read of size 4 at 0x7fffc004057c by thread T2:\n    #0 _Py_ExplicitMergeRefcount /cpython/Objects/object.c:477:40  \n    #1 _Py_brc_queue_object /cpython/Python/brc.c:73:31  \n    #2 _Py_DecRefSharedIsDead /cpython/Objects/object.c:413:9  \n    #3 _Py_DecRefSharedDebug /cpython/Objects/object.c:425:9 \n    #4 _Py_DecRefShared /cpython/Objects/object.c:433:5 \n    #5 Py_DECREF /cpython/./Include/refcount.h:385:9  \n    #6 Py_XDECREF /cpython/./Include/refcount.h:520:9 \n    #7 sys_set_flag /cpython/./Python/sysmodule.c:3486:5 \n    #8 _PySys_SetFlagObj /cpython/./Python/sysmodule.c:3498:5 \n    #9 _PySys_SetFlagInt /cpython/./Python/sysmodule.c:3512:15  \n    #10 _PySys_SetIntMaxStrDigits /cpython/./Python/sysmodule.c:4671:9 \n    #11 sys_set_int_max_str_digits_impl /cpython/./Python/sysmodule.c:1894:9  \n    #12 sys_set_int_max_str_digits /cpython/./Python/clinic/sysmodule.c.h:932:20 \n\n  Previous atomic write of size 4 at 0x7fffc004057c by thread T3:\n    #0 _Py_atomic_store_uint32_relaxed /cpython/./Include/cpython/pyatomic_gcc.h:493:3  \n    #1 Py_DECREF /cpython/./Include/refcount.h:379:9 \n    #2 Py_XDECREF /cpython/./Include/refcount.h:520:9 \n    #3 sys_set_flag /cpython/./Python/sysmodule.c:3486:5 \n    #4 _PySys_SetFlagObj /cpython/./Python/sysmodule.c:3498:5 \n    #5 _PySys_SetFlagInt /cpython/./Python/sysmodule.c:3512:15  \n    #6 _PySys_SetIntMaxStrDigits /cpython/./Python/sysmodule.c:4671:9 \n    #7 sys_set_int_max_str_digits_impl /cpython/./Python/sysmodule.c:1894:9  \n    #8 sys_set_int_max_str_digits /cpython/./Python/clinic/sysmodule.c.h:932:20 \n...\nSUMMARY: ThreadSanitizer: data race /cpython/Objects/object.c:477:40 in _Py_ExplicitMergeRefcount\n==================\n==================\nWARNING: ThreadSanitizer: data race (pid=1518581)\n  Read of size 8 at 0x7fffc4042720 by thread T3:\n    #0 long_dealloc /cpython/Objects/longobject.c:3653:9  \n    #1 _Py_Dealloc /cpython/Objects/object.c:3312:5  \n    #2 _Py_brc_queue_object /cpython/Python/brc.c  \n    #3 _Py_DecRefSharedIsDead /cpython/Objects/object.c:413:9  \n    #4 _Py_DecRefSharedDebug /cpython/Objects/object.c:425:9 \n    #5 _Py_DecRefShared /cpython/Objects/object.c:433:5 \n    #6 Py_DECREF /cpython/./Include/refcount.h:385:9  \n    #7 Py_XDECREF /cpython/./Include/refcount.h:520:9 \n    #8 sys_set_flag /cpython/./Python/sysmodule.c:3486:5 \n    #9 _PySys_SetFlagObj /cpython/./Python/sysmodule.c:3498:5 \n    #10 _PySys_SetFlagInt /cpython/./Python/sysmodule.c:3512:15  \n    #11 _PySys_SetIntMaxStrDigits /cpython/./Python/sysmodule.c:4671:9 \n    #12 sys_set_int_max_str_digits_impl /cpython/./Python/sysmodule.c:1894:9  \n    #13 sys_set_int_max_str_digits /cpython/./Python/clinic/sysmodule.c.h:932:20 \n\n  Previous write of size 8 at 0x7fffc4042720 by thread T4:\n    #0 _PyLong_SetSignAndDigitCount /cpython/./Include/internal/pycore_long.h:307:27  \n    #1 _PyLong_FromMedium /cpython/Objects/longobject.c:267:5 \n    #2 PyLong_FromLong /cpython/Objects/longobject.c:409:5  \n    #3 _PySys_SetFlagInt /cpython/./Python/sysmodule.c:3507:21  \n    #4 _PySys_SetIntMaxStrDigits /cpython/./Python/sysmodule.c:4671:9 \n    #5 sys_set_int_max_str_digits_impl /cpython/./Python/sysmodule.c:1894:9  \n    #6 sys_set_int_max_str_digits /cpython/./Python/clinic/sysmodule.c.h:932:20 \n...\nSUMMARY: ThreadSanitizer: data race /cpython/Objects/longobject.c:3653:9 in long_dealloc\n==================\n```\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-151220\n* gh-151402\n* gh-151552\n* gh-151553\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Naserume","@type":"Person","name":"Naserume"},"datePublished":"2026-06-10T03:58:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/151218/cpython/issues/151218"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5ff878f6-6894-d726-1878-0b1922404066
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8468:1ABF46:7D55F:AF1B5:6A59BC11
html-safe-noncece881ca281dbf038f8d7e7ac8a6631ccc0dec20aea1aebfe04e406e5dfea7d2c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDY4OjFBQkY0Njo3RDU1RjpBRjFCNTo2QTU5QkMxMSIsInZpc2l0b3JfaWQiOiIyMjczMTY1NDM5NTIxMTExMDU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac6566ebc920d0252c0f39e92c627ec101665263192ff73c59628c9898424c9918
hovercard-subject-tagissue:4627822440
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/151218/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1461a648e7a7c2698438015a17900e4d376d6f393f684e6d7fab57e331bc566a/python/cpython/issues/151218
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1461a648e7a7c2698438015a17900e4d376d6f393f684e6d7fab57e331bc566a/python/cpython/issues/151218
og:image:altBug report Bug description: sys.set_int_max_str_digits() updates sys.flags via sys_set_flag(), which modifies a shared struct-sequence slot without synchronization: cpython/Python/sysmodule.c Lines...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameNaserume
hostnamegithub.com
expected-hostnamegithub.com
Noneba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353
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
releaseab680789ae4a316cdaf0d5a292a1760140931cc4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/151218#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151218
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%2Fissues%2F151218
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%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/151218
Reloadhttps://github.com/python/cpython/issues/151218
Reloadhttps://github.com/python/cpython/issues/151218
Please reload this pagehttps://github.com/python/cpython/issues/151218
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/151218
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.9k 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
Data race in sys_set_flag when sys.set_int_max_str_digits() is called concurrently with free-threaded buildhttps://github.com/python/cpython/issues/151218#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%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/Naserume
Naserumehttps://github.com/Naserume
on Jun 10, 2026https://github.com/python/cpython/issues/151218#issue-4627822440
cpython/Python/sysmodule.chttps://github.com/python/cpython/blob/ce916dc50644bb1de940f5fb580bd9907cceb959/Python/sysmodule.c#L3479-L3487
ce916dchttps://github.com/python/cpython/commit/ce916dc50644bb1de940f5fb580bd9907cceb959
gh-151218: Fix data race in sys_set_flag for free-threading #151220https://github.com/python/cpython/pull/151220
gh-151218: Replace sys.flags in PyConfig_Set() #151402https://github.com/python/cpython/pull/151402
[3.15] gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402) #151552https://github.com/python/cpython/pull/151552
[3.14] gh-151218: Replace sys.flags in PyConfig_Set() (#151402) #151553https://github.com/python/cpython/pull/151553
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%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.