Skip to content

gh-145107: simplify staggered race using eager_start=False#145108

Merged
kumaraditya303 merged 4 commits into
python:mainfrom
graingert:145107-simplify-happy-eyeballs
Jul 24, 2026
Merged

gh-145107: simplify staggered race using eager_start=False#145108
kumaraditya303 merged 4 commits into
python:mainfrom
graingert:145107-simplify-happy-eyeballs

Conversation

@graingert

@graingert graingert commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

@graingert
graingert marked this pull request as ready for review February 22, 2026 11:39
@caje731

caje731 commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

LGTM!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_start Event gating from the internal run_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.

Comment thread Misc/NEWS.d/next/Library/2026-02-22-11-27-57.gh-issue-145107.ZlQXEZ.rst Outdated
Comment thread Lib/asyncio/staggered.py Outdated
Comment thread Lib/asyncio/staggered.py
Comment on lines +109 to +112
next_task = loop.create_task(
run_one_coro(this_failed),
eager_start=False,
)

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 7, 2026
@kumaraditya303
kumaraditya303 enabled auto-merge (squash) July 24, 2026 05:25
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jul 24, 2026
graingert and others added 4 commits July 24, 2026 19:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lQXEZ.rst

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kumaraditya303
kumaraditya303 force-pushed the 145107-simplify-happy-eyeballs branch from cb9bab6 to c269d95 Compare July 24, 2026 14:06
@kumaraditya303
kumaraditya303 merged commit 74f4b06 into python:main Jul 24, 2026
50 checks passed
@graingert
graingert deleted the 145107-simplify-happy-eyeballs branch July 24, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants