8000 Merge pull request #18 from jakkdl/8_expand_trio102 · python-trio/flake8-async@23e2d89 · GitHub
[go: up one dir, main page]

Skip to content

Commit 23e2d89

Browse files
authored
Merge pull request #18 from jakkdl/8_expand_trio102
Extend 102 to excepts, 104 also catch yield
2 parents 48b3e3c + 7460ec1 commit 23e2d89

File tree

7 files changed

+275
-164
lines changed

7 files changed

+275
-164
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
*[CalVer, YY.month.patch](https://calver.org/)*
33

4+
## 22.7.6
5+
- Extend TRIO102 to also check inside `except BaseException` and `except trio.Cancelled`
6+
- Extend TRIO104 to also check for `yield`
7+
- Update error messages on TRIO102 and TRIO103
8+
49
## 22.7.5
510
- Add TRIO103: `except BaseException` or `except trio.Cancelled` with a code path that doesn't re-raise
611
- Add TRIO104: "Cancelled and BaseException must be re-raised" if user tries to return or raise a different exception.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pip install flake8-trio
2222
context does not contain any `await` statements. This makes it pointless, as
2323
the timeout can only be triggered by a checkpoint.
2424
- **TRIO101**: `yield` inside a nursery or cancel scope is only safe when implementing a context manager - otherwise, it breaks exception handling.
25-
- **TRIO102**: it's unsafe to await inside `finally:` unless you use a shielded
25+
- **TRIO102**: it's unsafe to await inside `finally:` or `except BaseException/trio.Cancelled` unless you use a shielded
2626
cancel scope with a timeout.
2727
- **TRIO103**: `except BaseException` and `except trio.Cancelled` with a code path that doesn't re-raise. Note that any `raise` statements in loops are ignored since it's tricky to parse loop flow with `break`, `continue` and/or the zero-iteration case.
2828
- **TRIO104**: `Cancelled` and `BaseException` must be re-raised - when a user tries to `return` or `raise` a different exception.

0 commit comments

Comments
 (0)
0