python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
17 stars 2 forks source link

Error on async generator without known-safe decorators #96

Closed Zac-HD closed 1 year ago

Zac-HD commented 1 year ago

As discussed here, async generators make it very difficult to write cancellation-safe code, which is essential when you want to use timeouts (always) or directly cancel some tasks (not that rare either). I therefore think it's worth having a disabled-by-default check, TRIO900, which bans all async generators unless they have an @asynccontextmanager decorator.