-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
asyncio.create_task doesn't accept async_generator_asend objects #10185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @AlexWaygood |
@kumaraditya303 Could you give the error message, and the line the error appears in? Also, which mypy version are you using? |
@srittau Updated comment to include details. |
Here's a mypy playground link showing that it also reproduces on mypy 1.3.0. The cause of the error is that our stubs for Our annotations for typeshed/stdlib/asyncio/tasks.pyi Lines 314 to 321 in 2d5dafa
This leaves two possible fixes on the table:
|
I'm curious if @graingert has any thoughts on the best way to resolve this, as he was involved in the discussion around #7491 and helped review that PR! |
AsyncGenerator defines an interface based on returning awaitable objects and not coroutines so it makes sense to me that people should annotate their async def generators used with create_task with AsyncGeneratorType |
The following code fails to typecheck with mypy but works just fine at runtime.
Error:
mypy version: mypy 1.0.0 (compiled: yes)
The text was updated successfully, but these errors were encountered: