Fix dropped `for/else` re-raise in masking CM

`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
trio_0.33.0_support
Gud Boi 2026-05-29 21:10:23 -04:00
parent 30e15925ba
commit 325574cc07
1 changed files with 3 additions and 3 deletions

View File

@ -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