-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error on unused awaitable expressions (#12279)
Generates an error when an expression has a type which has a defined __await__ in its MRO but is not used. This includes all builtin awaitable objects (e.g. futures, coroutines, and tasks) but also anything a user might define which is also awaitable. A hint is attached to suggest awaiting. This can be extended in the future to other types of values that may lead to a resource leak if needed, or even exposed as a plugin. We test simple and complex cases (coroutines and user defined classes). We also test that __getattr__ does not create false positives for awaitables. Some tests require fixes, either because they were deliberately not awaiting an awaitable to verify some other logic in mypy, or because reveal_type returns the object, so it was generating an error we would rather simply silence,
- Loading branch information
Showing
6 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters