GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Deprecate asyncio policy system · Issue #127949 · python/cpython Closed Labels extension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancementA feature request or enhancement Descriptionasyncio's policy system deprecationasyncio'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 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. The 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 loop = MyCustomEventLoop() loop.run_until_complete(task) rather than currently asyncio.set_event_loop_policy(MyPolicy()) policy = asyncio.get_event_loop_policy() loop = policy.new_event_loop() loop.run_until_complete(task) See these discussions for more background:
Functions and classes to be deprecated and later removed
Functions to be modified
The Grand Plan
The Future---
title: Flowchart for asyncio.run
---
flowchart TD
A["asyncio.run(coro, loop_factory=...)"] --> B{loop_factory}
B -->|loop_factory is None| D{platform}
B -->|loop_factory is not None| E["loop = loop_factory()"]
D --> |Unix| F["loop = SelectorEventLoop()"]
D --> |Windows| G["loop = ProactorEventLoop()"]
E --> H
F --> H
G --> H
H["loop.run_until_complete(coro)"]
Linked PRs
FootnotesReacted by Kirill Podoprigora, Tomas R., Daniel Makhanek, Bénédikt Tran, Roman Kitaev, Ilya Siamionau, Nick Khitrov, Marsel Narbekov, Wulian233, Thomas Grainger and 4 more Reacted by SoundsSerious Activity
MetadataMetadataAssigneesLabelsextension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancementA feature request or enhancement Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |