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
{{ message }}
Repository navigation
ParamSpec errors when (re)used as generic argument #13403
Passing "through" a ParamSpec variable as argument up a generic class declaration chain generates errors.
I'm not sure if I'm taking an incorrect approach down here, but I'd like to be able to declare a decorator as a callable class that when decorating a function "disassembles" and copies the function signature on to the decorators __call__ signature.
To Reproduce
I'm running in to 2 slightly different errors when attempting the following two things. I can understand why I get the error on 1., but I'm a little bit confused by the error in 2.
Using a ParamSpec argument to assemble a callable, which is passed as new argument to a base class
fromtypingimportAny, Callable, Generic, ParamSpec, TypeVarP=ParamSpec("P")
C=TypeVar("C", bound=Callable[..., Any])
classBase(Generic[C]):
def__init__(self, func: C) ->None:
...
classChild(Base[Callable[P, Any]], Generic[P]): # yields -> error: The first argument to Callable must be a list of types, parameter specification, or "..."
...
Activity
A5rocks commentedon Feb 12, 2023
I think this works now! Check your mypy playground link -- since you were using
latestit'll use mypy 1.0 which fixes this!hauntsaninja commentedon Feb 12, 2023
Thanks for updating this issue!