"Arguments for ParamSpec are missing" error
bug
**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:
```python
_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:
```python
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
0 条评论