René's URL Explorer Experiment


Title: Deprecate asyncio policy system · Issue #127949 · python/cpython · GitHub

Open Graph Title: Deprecate asyncio policy system · Issue #127949 · python/cpython

X Title: Deprecate asyncio policy system · Issue #127949 · python/cpython

Description: asyncio's policy system deprecation asyncio's policy system1 has been a source of confusion and problems in asyncio for a very long time. The policies no longer serve a real purpose. Loops are always per thread, there is no need to have ...

Open Graph Description: asyncio's policy system deprecation asyncio's policy system1 has been a source of confusion and problems in asyncio for a very long time. The policies no longer serve a real purpose. Loops are alwa...

X Description: asyncio's policy system deprecation asyncio's policy system1 has been a source of confusion and problems in asyncio for a very long time. The policies no longer serve a real purpose. Loops ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate asyncio policy system","articleBody":"#### asyncio's policy system deprecation\r\n\r\nasyncio's policy system[^1] has been a source of confusion and problems in asyncio for a very long time. The policies no longer serve a real purpose. Loops are always per thread, there is no need to have a \"current loop\" when no loop is currently running. This issue discusses the changes to deprecate it in Python 3.14 and schedule its removal in 3.16 or later.\r\n\r\nThe usual user applications would use the runner APIs (see flowchart) while those who want more control like Jupyter project can create an event loop and manage it themselves, the difference would be that instead of them first getting the policy then event loop then can directly create it like\r\n\r\n```py\r\nloop = MyCustomEventLoop()\r\nloop.run_until_complete(task)\r\n```\r\nrather than currently\r\n```py\r\nasyncio.set_event_loop_policy(MyPolicy())\r\npolicy = asyncio.get_event_loop_policy()\r\nloop = policy.new_event_loop()\r\nloop.run_until_complete(task)\r\n```\r\n\r\nSee these discussions for more background:\r\n\r\n- https://github.com/python/cpython/issues/83710#issuecomment-1093855411\r\n- https://github.com/python/cpython/issues/93453#issue-1259542498\r\n- https://github.com/python/cpython/issues/94597#issuecomment-1270840197\r\n- https://github.com/python/cpython/issues/94597\r\n\r\n##### Functions and classes to be deprecated and later removed\r\n- [x] `asyncio.get_event_loop_policy`\r\n- [x] `asyncio.set_event_loop_policy`\r\n- [x] `asyncio.AbstractEventLoopPolicy`\r\n- [x] `asyncio.DefaultEventLoopPolicy`\r\n- [x] `asyncio.WindowsSelectorEventLoopPolicy`\r\n- [x] `asyncio.WindowsProactorEventLoopPolicy`\r\n- [x] `asyncio.set_event_loop`\r\n\r\n##### Functions to be modified\r\n- `asyncio.get_event_loop` - In 3.16 or later this will become an alias to `get_running_loop`.\r\n- `asyncio.new_event_loop` - In 3.16 or later this will ignore custom policies and will be an alias to `asyncio.EventLoop`\r\n- `asyncio.run` \u0026 `asyncio.Runner` - In 3.16 or later this will be modified to not use policy system as that will be gone and rely solely on *loop_factory*.\r\n\r\n#### The Grand Plan\r\n\r\n- To minimize changes, all the deprecated functions will be underscored i.e. `set_event_loop` -\u003e `_set_event_loop` and `set_event_loop` will emit the warning then call `_set_event_loop` as its underlying implementation. This way internally asyncio can still call these functions until they are removed without need of many ignore warnings and the tests too can easily be adapted.\r\n- The deprecated classes will emit warnings when they are subclassed as it was done for child watchers.\r\n- The runner APIs will be remain unmodified but making sure that correct warnings are emitted internally when policy system is used.\r\n\r\n#### The Future\r\n\r\n\r\n```mermaid\r\n---\r\ntitle: Flowchart for asyncio.run\r\n---\r\nflowchart TD\r\n    A[\"asyncio.run(coro, loop_factory=...)\"] --\u003e B{loop_factory}\r\n    B --\u003e|loop_factory is None| D{platform}\r\n    B --\u003e|loop_factory is not None| E[\"loop = loop_factory()\"]\r\n    D --\u003e |Unix| F[\"loop = SelectorEventLoop()\"]\r\n    D --\u003e |Windows| G[\"loop = ProactorEventLoop()\"]\r\n    E --\u003e H\r\n    F --\u003e H\r\n    G --\u003e H \r\n    H[\"loop.run_until_complete(coro)\"]\r\n```\r\n\r\n\r\n[^1]: https://docs.python.org/3.14/library/asyncio-policy.html\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-128024\r\n* gh-128053\r\n* gh-128172\r\n* gh-128215\r\n* gh-128216\r\n* gh-128218\n* gh-128269\n* gh-128290\n* gh-131805\n* gh-131806\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/kumaraditya303","@type":"Person","name":"kumaraditya303"},"datePublished":"2024-12-14T16:37:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/127949/cpython/issues/127949"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9aeaf40d-6645-52c9-9168-abe1c3f763ce
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9F22:2786B7:AD2310:EB6B8D:6969E58D
html-safe-nonce1405cd4e896c5098427f4acd739f4228544776f1d894c15a0f5bee8ef27218b9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjIyOjI3ODZCNzpBRDIzMTA6RUI2QjhEOjY5NjlFNThEIiwidmlzaXRvcl9pZCI6IjQyMDUwMTc5MjY1Mzc0Mzg2MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb6b6658d29e8873be7dfe90fd3916d1c76cd88db0f19d53c6eefcd6800997bc2
hovercard-subject-tagissue:2739981235
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/127949/issue_layout
twitter:imagehttps://opengraph.githubassets.com/61208b4cf17d3e4e1c4e00494e79dfd15e39d7d394af587295ddc4fbd13c9865/python/cpython/issues/127949
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/61208b4cf17d3e4e1c4e00494e79dfd15e39d7d394af587295ddc4fbd13c9865/python/cpython/issues/127949
og:image:altasyncio's policy system deprecation asyncio's policy system1 has been a source of confusion and problems in asyncio for a very long time. The policies no longer serve a real purpose. Loops are alwa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekumaraditya303
hostnamegithub.com
expected-hostnamegithub.com
None7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8
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
releasebdde15ad1b403e23b08bbd89b53fbe6bdf688cad
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/127949#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F127949
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2F127949
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/127949
Reloadhttps://github.com/python/cpython/issues/127949
Reloadhttps://github.com/python/cpython/issues/127949
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/127949
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k 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.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/127949
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 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/127949
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/127949
Deprecate asyncio policy systemhttps://github.com/python/cpython/issues/127949#top
https://github.com/kumaraditya303
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/kumaraditya303
https://github.com/kumaraditya303
kumaraditya303https://github.com/kumaraditya303
on Dec 14, 2024https://github.com/python/cpython/issues/127949#issue-2739981235
1https://github.com/python/cpython/issues/127949#user-content-fn-1-6d2590ec3ce81e517c3453b002253fa8
Deprecate get_event_loop() #83710 (comment)https://github.com/python/cpython/issues/83710#issuecomment-1093855411
Finish deprecation in asyncio.get_event_loop() #93453 (comment)https://github.com/python/cpython/issues/93453#issue-1259542498
deprecate the asyncio child watchers system #94597 (comment)https://github.com/python/cpython/issues/94597#issuecomment-1270840197
deprecate the asyncio child watchers system #94597https://github.com/python/cpython/issues/94597
gh-127949: deprecate asyncio.set_event_loop_policy #128024https://github.com/python/cpython/pull/128024
gh-127949: deprecate asyncio.get_event_loop_policy #128053https://github.com/python/cpython/pull/128053
gh-127949: fix resource warnings in test_tasks.py due to avoiding a call to get_event_loop() #128172https://github.com/python/cpython/pull/128172
gh-127949: fix DeprecationWarning in test_inspect.py #128215https://github.com/python/cpython/pull/128215
gh-127949: deprecate asyncio policy classes #128216https://github.com/python/cpython/pull/128216
gh-127949: deprecate asyncio.set_event_loop #128218https://github.com/python/cpython/pull/128218
gh-127949: add docs for asyncio policy deprecation #128269https://github.com/python/cpython/pull/128269
gh-127949: make deprecation of policy system more prominent #128290https://github.com/python/cpython/pull/128290
[3.13] gh-127949: fix resource warnings in test_tasks.py (GH-128172) #131805https://github.com/python/cpython/pull/131805
[3.12] gh-127949: fix resource warnings in test_tasks.py (GH-128172) #131806https://github.com/python/cpython/pull/131806
https://docs.python.org/3.14/library/asyncio-policy.htmlhttps://docs.python.org/3.14/library/asyncio-policy.html
https://github.com/python/cpython/issues/127949#user-content-fnref-1-6d2590ec3ce81e517c3453b002253fa8
kumaraditya303https://github.com/kumaraditya303
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
asynciohttps://github.com/orgs/python/projects/29
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.