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
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 "..."
...
Bug Report
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.
ParamSpec
as argument, directlyParamSpec
argument to assemble a callable, which is passed as new argument to a base classExtended use case through playground
Expected Behavior
I'd like to be able to use a
ParamSpec
variable to pass on an expected definition to some base class.Actual Behavior
Mypy yields errors when "passing" a
ParamSpec
as a generic error to some base class.Your Environment
mypy.ini
(and other config files): -The text was updated successfully, but these errors were encountered: