Skip to content

Generic types that use ParamSpec aren't callable #11846

Description

@NeilGirdhar
fromfunctoolsimportpartialfromtypingimportCallable, Generic, TypeVarfromtyping_extensionsimportParamSpecR=TypeVar('R')
P=ParamSpec('P')
classcustom_vjp(Generic[P, R]):
def__init__(self, fun: Callable[P, R], x: int=0):
self.fun=fundef__call__(self, *args: P.args, **kwargs: P.kwargs) ->R:
returnself.fun(*args, **kwargs)
partial(custom_vjp, x=0) # error: Argument 1 to "partial" has incompatible type "Type[custom_vjp[Any, Any]]"; expected "Callable[..., custom_vjp[P, R]]" [arg-type]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-paramspecPEP 612, ParamSpec, Concatenate

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions