You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncdeflisten(self) ->AsyncIterator:
"""Listen for messages on channels this client has been subscribed to"""whileself.subscribed:
response=awaitself.handle_message(awaitself.parse_response(block=True))
ifresponseisnotNone:
yieldresponse
Even though signatures are equivalent, mypy interprets the stub to be a coroutine that returns an AsyncIterator.
For example, this is runtime valid, but mypy finds an error:
asyncformessageinpubsub.listen():
...
error: "Coroutine[Any, Any, AsyncIterator[Any]]" has no attribute "__aiter__" (not async iterable) [attr-defined]
This is invalid code, but passes mypy:
asyncformessageinawaitpubsub.listen():
...
TypeError: object async_generator can't be used in 'await' expression
…stubs. (#8961)
Without the `yield` statement in the method body, these are interpreted by mypy as coroutines that return an `AsyncIterator`.
Closes#8960
Stub for
redis.async.PubSub.listen()
:typeshed/stubs/redis/redis/asyncio/client.pyi
Line 157 in 50da0aa
Actual Implementation:
Even though signatures are equivalent, mypy interprets the stub to be a coroutine that returns an
AsyncIterator
.For example, this is runtime valid, but mypy finds an error:
This is invalid code, but passes mypy:
References:
The text was updated successfully, but these errors were encountered: