-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
randolf-scholz/mypy
#6Labels
bugmypy got something wrongmypy got something wrongtopic-paramspecPEP 612, ParamSpec, ConcatenatePEP 612, ParamSpec, Concatenatetopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)
Description
This should type check, but
from typing import Callable, TypeVarTuple
def run[T, **P](fn: Callable[P, T], *args: P.args, **kwargs: P.kwargs) -> T: ...
def coroutine_or_error[*Us](async_fn: Callable[[*Us], int], *args: *Us) -> int: ...
def test[*Ts](async_fn: Callable[[*Ts], int], args: tuple[*Ts]) -> None:
run(coroutine_or_error, async_fn, *args)
https://mypy-play.net/?mypy=latest&python=3.12&gist=e43aee5d75dd536ed2529b3dc052e630 gives
Argument 1 to "run" has incompatible type "Callable[[Callable[[VarArg(*Us)], int], VarArg(*Us)], int]"; expected "Callable[[Callable[[VarArg(*Ts)], int], VarArg(object)], int]" [arg-type]
Example derived from https://github.com/python-trio/trio/blob/f1039299644dfaf6dcd60ed29a4a3a51494d09a4/src/trio/_core/_run.py#L1970
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-paramspecPEP 612, ParamSpec, ConcatenatePEP 612, ParamSpec, Concatenatetopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)