Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle critical exceptions in anyio #122

Closed
jakkdl opened this issue Feb 3, 2023 · 0 comments · Fixed by #127
Closed

Handle critical exceptions in anyio #122

jakkdl opened this issue Feb 3, 2023 · 0 comments · Fixed by #127
Assignees

Comments

@jakkdl
Copy link
Member

jakkdl commented Feb 3, 2023

Matters w/r/t TRIO102, 103 and 104.

flake8-trio currently always just looks for trio.Cancelled, but
#120 (comment)

Unfortunately anyio has a slightly different API here; see anyio.get_cancelled_exc_class(). That's important because you can have both trio and asyncio in the same program (ugh, but sometimes the least-bad option!).

Also add another error code for assigning the result of anyio.get_cancelled_exc_class() to a variable. That can be caught if within the same file with our rudimentary type tracking, but not if done across files and imported. So the plugin should likely track assignments for cases where single-backend is used and the error code gets disabled.

We probably also want to lint for "no assigning that result because it breaks our linter, as well as multi-backend programs".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant