Skip to content

Commit d67fc70

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d20305b commit d67fc70

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

docs/rules.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ _`ASYNC120` : await-in-except
8585
If this checkpoint is cancelled, the current active exception will be replaced by the ``Cancelled`` exception, and cannot be reraised later.
8686
This will not trigger when :ref:`ASYNC102 <ASYNC102>` does, and if you don't care about losing non-cancelled exceptions you could disable this rule.
8787
This is currently not able to detect asyncio shields.
88-
88+
8989
To handle this correctly, use a shielded cancel scope with a timeout::
90-
90+
9191
try:
9292
await process()
9393
except Exception:
9494
with trio.fail_after(seconds, shield=True):
9595
await cleanup()
9696
raise
97-
97+
9898
The shield prevents cancellation from replacing the current exception, while the timeout ensures cleanup can't block indefinitely. Use :func:`trio.move_on_after` if you want to suppress timeout errors rather than raise them.
9999

100100
_`ASYNC121`: control-flow-in-taskgroup

0 commit comments

Comments
 (0)