-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid ParamSpec usage in function with added kwargs not reported as error #14832
Comments
This is the cause of #13966 - the invalid usage is not reported there. |
In general mypy doesn't seem to be picking up on errors around the 'rejected' behaviours, just silently ignoring the annotion? Eg: the following code, case
this code generates no issues in mypy 1.0.1 but pyright 1.1.339 correctly flags errors for each of cases 2 .. 5:
|
See here for a discussion to make this happen: https://discuss.python.org/t/type-hints-for-kwarg-overrides/47196 |
Bug Report
According to PEP-612,
However,
mypy
doesn't reject such usage.To Reproduce
Playground
Also consider this code quoted from PEP-612:
And here's another playground.
Expected Behavior
In first case the
__call__
definition should be flagged as error.In second case the behaviour should match the inline comments.
Actual Behavior
In first case no errors are found.
In second case
foo
is rejected due to named arguments (this violates PEP-612, but is easily fixable with__s
arg name instead, as usual, error message can be improved here). whilebar
is accepted, also violating the PEP:Your Environment
--strict
and without itmypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: