Repository navigation
gh-128289: Add eager_tasks parameter to asyncio.run() and asyncio.Runner - #128293
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. |
|
This PR is stale because it has been open for 30 days with no activity. |
There was a problem hiding this comment.
@asvetlov -- LGTM except everything needs to be moved over to 3.15 now... And before May 1 to make the beta 1 deadline (feature cut-off).
|
This PR is stale because it has been open for 90 days with no activity. |
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
# Conflicts: # Doc/library/asyncio-runner.rst
Documentation build overview
|
📚 Documentation preview 📚: https://cpython-previews--128293.org.readthedocs.build/