From daa661aba3708901cd0268b45f2ac5b920146101 Mon Sep 17 00:00:00 2001 From: goodboy Date: Tue, 11 Aug 2026 11:38:43 -0400 Subject: [PATCH] Clarify `maybe_open_context()` teardown notes Drop the stale sentinel experiment and fix the cancellation-path comment. Document that cached regular `__aexit__()` failures are always re-raised at the final consumer boundary. Review: PR #488 (goodboy) https://github.com/goodboy/tractor/pull/488 (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`)) --- tractor/trionics/_mngrs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tractor/trionics/_mngrs.py b/tractor/trionics/_mngrs.py index df92f4f7..1304e50e 100644 --- a/tractor/trionics/_mngrs.py +++ b/tractor/trionics/_mngrs.py @@ -315,7 +315,6 @@ async def maybe_open_context( ) # yielded output - # sentinel = object() yielded: Any = _UnresolvedCtx user_registered: bool = False ctx_exit: _CtxExit|None = None @@ -508,7 +507,7 @@ async def maybe_open_context( f'acm_func={acm_func!r}\n' ) - # XXX: if we're cancelled we the entry may + # XXX: if we're cancelled, the entry may # have never been entered since the nursery # task was killed. entry = _Cache.resources.get(ctx_key) @@ -541,4 +540,6 @@ async def maybe_open_context( lock.release() if exit_error is not None: + # Always re-raise a regular `__aexit__()` error at the + # final consumer's context boundary. raise exit_error