gh-94597: add asyncio.EventLoop#110723
Conversation
|
This allows running asyncio coroutines without interacting with the policy system eg: asyncio.run(main(), loop_factory=asyncio.EventLoop)
# no need to call asyncio.set_event_loop_policy(None) !this allows code to run without interfering with a policy that has been set in one location especially one that expects |
Sorry, something went wrong.
gvanrossum
left a comment
There was a problem hiding this comment.
Do you intend this to be merged before or after the deprecations PR?
Sorry, something went wrong.
…PC8t.rst Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
I don't mind what order the PRs go in - I plan a cleanup PR for the CPython test suite removing redundant calls to |
Sorry, something went wrong.
it's always available
gvanrossum
left a comment
There was a problem hiding this comment.
Thanks! Merging now.
Sorry, something went wrong.
Well. In the early days of tulip/asyncio, there were more choices, and we didn't know how third-party projects will inherit/override these classes. Now I agree that asyncio.EventLoop is the way to go, it's easier to remind, it's more explicit, and it's easy to guess what is it (SelectorEventLoop or ProactorEventLoop). |
Sorry, something went wrong.
This is needed to pave the way for deprecating and eventually killing the event loop policy system (which is over-engineered and rarely used).
📚 Documentation preview 📚: https://cpython-previews--110723.org.readthedocs.build/