Skip to content

Modernization 2 - #7

Merged
transfix merged 29 commits into
masterfrom
modernization-2
Jan 9, 2026
Merged

transfix merged 29 commits into
masterfrom
modernization-2

Conversation

@transfix

@transfix transfix commented Jan 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

@transfix
transfix merged commit 7b8a389 into master Jan 9, 2026
@transfix
transfix deleted the modernization-2 branch January 9, 2026 18:08
transfix added a commit that referenced this pull request Sep 29, 2026
An adversarial review of register_async_coro found 8 issues. Fixes:

- drive_coros: run_forever is now called ONLY when the call_later(budget) stop
  timer is armed (else it would never return), and a failed loop step FAILS every
  pending coroutine (posts an __async_error__) instead of clearing the error and
  spinning an unkillable pump. (#2, #5)
- run() gains a re-entrancy guard: a registered fn/coro that calls back into run()
  now raises immediately instead of corrupting the shared scheduler + asyncio loop
  (one Exec is driven by one thread). (#4)
- Coroutine Tasks are run-scoped: a RAII guard cancels + drops any left pending at
  every run() exit, so an orphaned coroutine of a sibling process can't suppress
  the NEXT run()'s idle timeout. (#6)
- register_fn / register_async_fn reject an async def up front (use
  register_async_coro), so it can't be marshalled as an un-awaited-coroutine repr
  string. (#7)
- Docs corrected: the coro slice is COOPERATIVE (asyncio can't preempt a running
  step), so a coroutine MUST yield — CPU/blocking work belongs in register_async_fn;
  a never-resolving await leaves run() waiting like a never-returning callable; and
  __async_error__ is a reserved result key. (#1, #3, #8)

Tests: async-def-rejected-by-sync-and-pool-paths, reentrant-run-is-rejected (+ Exec
stays usable). Full coro suite 7, exec 7, exec-async 5 green.
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.

1 participant