-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)
Description
I think this is a bug in mypy.
mypy-play.net
I want to properly annotate a generic async context manager to preserve the types of the *args in the returned value.
Ts = TypeVarTuple('Ts')
@asynccontextmanager
async def fun(*args: *Ts) -> AsyncIterator[tuple[*Ts]]:
...
but this snippet generate the following error
main.py:11: error: Argument 1 to "asynccontextmanager" has incompatible type "Callable[[VarArg(*Ts)], AsyncIterator[tuple[*Ts]]]"; expected "Callable[[VarArg(Never), KwArg(Never)], AsyncIterator[Never]]" [arg-type]
The function types - without the @asynccontextmanager
- seems to work correctly
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)