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`))
wkt/moc_teardown_completion
Gud Boi 2026-08-11 11:38:43 -04:00
parent 55ec3dbf51
commit daa661aba3
1 changed files with 3 additions and 2 deletions

View File

@ -315,7 +315,6 @@ async def maybe_open_context(
) )
# yielded output # yielded output
# sentinel = object()
yielded: Any = _UnresolvedCtx yielded: Any = _UnresolvedCtx
user_registered: bool = False user_registered: bool = False
ctx_exit: _CtxExit|None = None ctx_exit: _CtxExit|None = None
@ -508,7 +507,7 @@ async def maybe_open_context(
f'acm_func={acm_func!r}\n' 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 # have never been entered since the nursery
# task was killed. # task was killed.
entry = _Cache.resources.get(ctx_key) entry = _Cache.resources.get(ctx_key)
@ -541,4 +540,6 @@ async def maybe_open_context(
lock.release() lock.release()
if exit_error is not None: if exit_error is not None:
# Always re-raise a regular `__aexit__()` error at the
# final consumer's context boundary.
raise exit_error raise exit_error