Closed audoh-tickitto closed 3 years ago
Thanks for the bug report. Pylance wasn't correctly handling the case where an async method had a declared return type of AsyncGenerator
but was not itself a generator (i.e. had no yield
statement). In that case, the effective return type of the method needs to be wrapped in a Coroutine
type.
This will be fixed in the next release of Pylance.
This issue has been fixed in version 2021.4.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202141-14-april-2021
Environment data
Expected behaviour
Non-generator (no yield) async functions which return async iterables, generators etc should have a return type of
Coroutine[Any, Any, AsyncIterable]
(replace AsyncIterable with AsyncGenerator or other relevant type)Actual behaviour
Non-generator (no yield) async functions which return async iterables, generators etc have a return type of
AsyncIterable
(replace AsyncIterable with AsyncGenerator or other relevant type)Logs
Code Snippet / Additional information
When run in Python, the expected output is produced: