-
Notifications
You must be signed in to change notification settings - Fork 1.8k
"Arguments for ParamSpec are missing" error #11358
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Please have a look at python/typeshed#15597. In this PR, I try to change operator.methodcaller to use a ParamSpec with defaults:
_P = ParamSpec("_P", default=...)
_R = TypeVar("_R", default=Any)
@final
class methodcaller(Generic[_P, _R]):
def __new__(cls, name: str, /, *args: _P.args, **kwargs: _P.kwargs) -> methodcaller[_P, Any]: ...
def __call__(self, obj: Any) -> _R: ...Unfortunately, the following test cases then fail:
m1 = methodcaller("foo") # Arguments for ParamSpec "_P@methodcaller" are missing (reportCallIssue)
assert_type(m1, methodcaller[[], Any]) # "assert_type" mismatch: expected "methodcaller[(), Any]" but received "methodcaller[..., Any]"
m2 = methodcaller("foo", 42, bar="") # Arguments for ParamSpec "_P@methodcaller" are missing (reportCallIssue)I'm unsure what there problem here seems to be.
From the CI environment:
pyright 1.1.408, node v24.14.0, pyright-action 3.0.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working