From 325574cc0790623de48da86d229a2c60da1553fb Mon Sep 17 00:00:00 2001 From: goodboy Date: Fri, 29 May 2026 21:10:23 -0400 Subject: [PATCH] Fix dropped `for/else` re-raise in masking CM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `30e15925` ("Add `start_or_cancel()` to `trionics._taskc`") inserted `async def start_or_cancel()` — whose body opens its own col-4 `try:` — immediately before the trailing `else: raise`. Because the edit was a pure insertion (0 deletions), the *same* `else: raise` lines were silently REPARENTED: they used to be the `for exc_match in matching: ... else: raise` of `maybe_raise_from_masking_exc`, but now bind to `start_or_cancel`'s `try/except` where they're unreachable dead code. Net effect: `maybe_raise_from_masking_exc` lost the `for/else` re-raise of the un-masked exception, so a masked child cancellation gets swallowed instead of surfaced. - restore the `for/else: raise` to `maybe_raise_from_masking_exc` - drop the now-dead `else: raise` from `start_or_cancel` Surfaced as 2 deterministic failures in `test_sigint_closes_lifetime_stack[wait_for_ctx-bg_aio_task- send_SIGINT_to=child-*]` (the SIGINT-to-child "silent-abandon" regime). Bisected with `trio` held at `0.29.0`: clean at `9c36363b` (0/8), broken at `30e15925` (8/8), fixed (0/8). NOT a `trio` (0.29↔0.33 identical) nor logging-plugin regression. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tractor/trionics/_taskc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tractor/trionics/_taskc.py b/tractor/trionics/_taskc.py index e50b28f9..13310ff1 100644 --- a/tractor/trionics/_taskc.py +++ b/tractor/trionics/_taskc.py @@ -296,6 +296,9 @@ async def maybe_raise_from_masking_exc( if raise_unmasked: raise exc_ctx from exc_match + else: + raise + async def start_or_cancel( nursery: trio.Nursery, @@ -345,6 +348,3 @@ async def start_or_cancel( await trio.lowlevel.checkpoint_if_cancelled() raise - - else: - raise