Fix once-only and awaitable event listeners - #829
Draft
dmulcahey wants to merge 1 commit into
Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #829 +/- ##
=======================================
Coverage 97.19% 97.19%
=======================================
Files 57 57
Lines 10560 10560
=======================================
Hits 10264 10264
Misses 296 296 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dmulcahey
force-pushed
the
codex-updated-pr-687
branch
from
September 5, 2026 19:07
aaf05cd to
4691fd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An asynchronous
once()listener is not unsubscribed until its task runs, so two immediate emits can invoke it twice. Reentrant emits can also revisit a listener captured by an outer emit. Callable objects with asynchronous__call__, and synchronous callbacks returning awaitables, are currently left unscheduled.Consume once-listeners synchronously and schedule/track the value returned by a callback when it is awaitable.
ensure_future()accepts both coroutines and existing futures/tasks. Regression tests cover back-to-back and reentrant emits, async callable objects, and returned futures/tasks.Supersedes #687. This refresh is limited to event delivery; it drops the unrelated concurrency-limit validation and periodic-cancellation behavior changes.
Validation against
devat66603431339afe37fa0048b70ff31d77dceb8f95: Python 3.12 full suite, 1387 passed, coverage above the 95% project gate; full pre-commit (codespell, Ruff, formatting, mypy, lock check) passed. Relevant regression checks fail on the unchanged base. GitHub CI for Python 3.12/3.13/3.14 is reported separately on the PR.