python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
18.56k stars 2.84k forks source link

Unannotated async function should be inferred as `Awaitable[Any]` #12776

Open Dreamsorcerer opened 2 years ago

Dreamsorcerer commented 2 years ago

An async function with no return type declaration, like: async def foo():

This is inferred as returning Any, but should be inferred as returning Awaitable[Any]. The result of this has caused us to miss a bunch of unused awaitable warnings via incomplete stubs.

JelleZijlstra commented 2 years ago

Probably even Coroutine[Any, Any, Any]

ritikBhandari commented 2 years ago

so we've to change its return type to Awaitable[Any] right?