self
not considered positional-only when followed by **kwargs
#19051
Labels
bug
mypy got something wrong
Bug Report
The following example using
Concatenate
to represent a method passes mypy in strict mode:https://mypy-play.net/?mypy=master&python=3.12&flags=strict&gist=5d5a1b27f2838371bee58b2d9c9a7721
However, if the signature has
**kwargs
, it fails withArgument 2 to "check" has incompatible type ... This is likely because "method of MyClass" has named arguments: "self"
.https://mypy-play.net/?mypy=master&python=3.12&flags=strict&gist=ef01c9fd1251d95be27ce96401ec7fe8
Explicitly making
self
positional-only fixes this, but in my case, I don't control the method signature (in my actual use case, the method isargparse.ArgumentParser.add_argument()
and the function iscopy_method_params()
from python/cpython#121693).To Reproduce
https://mypy-play.net/?mypy=master&python=3.12&flags=strict&gist=ef01c9fd1251d95be27ce96401ec7fe8
Expected Behavior
There should be no errors.
Actual Behavior
There is an error:
Your Environment
The text was updated successfully, but these errors were encountered: