gh-145107: simplify staggered race using eager_start=False#145108
Conversation
|
LGTM! |
There was a problem hiding this comment.
Pull request overview
This PR simplifies asyncio.staggered.staggered_race() by removing the internal “ok_to_start” synchronization mechanism and instead creating tasks with eager_start=False to avoid eager-execution ordering issues (gh-145107).
Changes:
- Remove the
ok_to_start/next_ok_to_startEventgating from the internalrun_one_coro()chain. - Create staggered-race tasks with
loop.create_task(..., eager_start=False)to prevent eager execution. - Add a Misc/NEWS.d entry documenting the change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
Lib/asyncio/staggered.py |
Reworks task creation in staggered_race() to use eager_start=False and drops the extra coordination events. |
Misc/NEWS.d/next/Library/2026-02-22-11-27-57.gh-issue-145107.ZlQXEZ.rst |
Adds a release-note fragment for the staggered_race change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| next_task = loop.create_task( | ||
| run_one_coro(this_failed), | ||
| eager_start=False, | ||
| ) |
There was a problem hiding this comment.
By forcing eager_start=False here, staggered_race will no longer exercise the eager-start path even when an eager task factory is installed; existing regression tests named “with eager tasks” may become less meaningful. Consider adding/adjusting a test that asserts staggered_race passes eager_start=False (e.g., via a task factory that records the eager_start kwarg) so this behavior can’t regress silently.
|
This PR is stale because it has been open for 30 days with no activity. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lQXEZ.rst Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cb9bab6 to
c269d95
Compare
Uh oh!
There was an error while loading. Please reload this page.