Skip to content

Incompatible type when using ParamSpec #12169

Description

@NeilGirdhar

Maybe I've misunderstood how parameter specification variables are supposed to used, but this is what I have:

fromtypingimportTypeVar, Generic, ParamSpec, Protocol, CallablefromfunctoolsimportpartialT=TypeVar("T", covariant=True)
P=ParamSpec("P")
classJittedFunction(Protocol, Generic[P, T]):
def__call__(self, *args: P.args, **kwargs: P.kwargs) ->T:
...
deflower(self) ->int:
...
defjit(fun: Callable[P, T], *, x: int) ->JittedFunction[P, T]:
pass@partial(jit, x=2) # error: Argument 1 to "partial" has incompatible type "Callable[[Callable[P, Any], NamedArg(int, 'x')], JittedFunction[P]]"; expected "Callable[..., JittedFunction[P]]" [arg-type]deff(y: int) ->int:
returny

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