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
If you call .result() on a submitted async task mypy believes that the call should be awaited. However the .result() is not a coroutine and following the mypy suggestion results in a TypeError.
However mypy thinks that line 16 ,b = test_function(a), has a problem
test.py:16: error: Argument 1 to "test_function" has incompatible type "Coroutine[Any, Any, int]"; expected "int" [arg-type]
test.py:16: note: Maybe you forgot to use "await"?
If you await .result() you get:
TypeError: object int can't be used in 'await' expression
Version info
mypy 1.14.1
prefect 3.1.13 | 3.1.14.dev3
Additional context
No response
The text was updated successfully, but these errors were encountered:
mthanded
changed the title
Mypy incorrectly suggests that .result() for submitted async task should be awaited
Incorrect type on .result() for a submitted async task results in invalid mypy suggestion
Jan 22, 2025
Bug summary
If you call .result() on a submitted async task mypy believes that the call should be awaited. However the .result() is not a coroutine and following the mypy suggestion results in a TypeError.
Example:
The code above runs correctly outputting
However mypy thinks that line 16 ,
b = test_function(a)
, has a problemIf you await .result() you get:
Version info
Additional context
No response
The text was updated successfully, but these errors were encountered: