-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-128289: Add eager_tasks parameter to asyncio.run() and asyncio.Runner #128293
base: main
Are you sure you want to change the base?
Conversation
@gvanrossum does the PR fit your vision? |
A failed hypothesis test for glob is definitely not related to the PR, it is broken in the main branch already. |
This will also need some way to set this in IsolatedAsyncioTestCase |
Good idea. A classvar attribute with special name maybe, something like I would update async test case when this PR will land. |
Possibly we could stick to just using loop_factory for this and asyncio.Task can issue the deprecation warning if eager isn't set to True in the constructor. (We could use eager = True, False or None to decide the warning) |
Sorry, I don't follow how loop_factory is related to lazy/eager task creation. Could you please elaborate? |
Currently for 3.13 to enable eager tasks the approach is to do: def loop_factory():
loop = asyncio.EventLoop()
loop.set_task_factory(asyncio.eager_task_factory)
return loop
asyncio.run(amain(), loop_factory=loop_factory) So this should still work and not trigger a deprecation warning |
I consider |
We could provide an eager loop factory and deprecate calling Code would look like |
I've got you finally, I hope. |
📚 Documentation preview 📚: https://cpython-previews--128293.org.readthedocs.build/