-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
issue with ParamSpec and Callable of Callables #16405
Comments
This may be caused by #15896, IIRC. It was kind of an intentional trade-of. We added support for some more common cases (e.g. generic apply with positional arguments) knowing this may cause some regressions for more tricky cases (e.g. those involving keyword-only arguments). The decision was to see what use cases people actually need, and add some special-casing accordingly. Since this is quite a tricky thing, the fix will not be available in 1.7, even though this is technically a regression (unless I will find a low-risk solution), fix will probably be available in 1.8. |
Fixes #16405 Fixes #16412 Imprecise argument kinds inference was added a while ago to support various edge cases with `ParamSpec`. This feature required mapping actual kinds to formal kinds, which is in general undecidable. At that time we decided to not add much special-casing, and wait for some real use-cases. So far there are two relevant issues, and it looks like both of them can be fixed with simple special-casing: ignore argument positions in subtyping if arguments can be matched by name. This adds minor unsafety, and generally doesn't look bad, so I think we should go ahead with it. --------- Co-authored-by: Alex Waygood <[email protected]>
Fixes #16405 Fixes #16412 Imprecise argument kinds inference was added a while ago to support various edge cases with `ParamSpec`. This feature required mapping actual kinds to formal kinds, which is in general undecidable. At that time we decided to not add much special-casing, and wait for some real use-cases. So far there are two relevant issues, and it looks like both of them can be fixed with simple special-casing: ignore argument positions in subtyping if arguments can be matched by name. This adds minor unsafety, and generally doesn't look bad, so I think we should go ahead with it. --------- Co-authored-by: Alex Waygood <[email protected]>
Bug Report
When using ParamSpec and passing a Callable that takes a Callable, mypy 1.6.0, 1.6.1 and master rejects the input, this is a regression from 1.5.1
To Reproduce
https://mypy-play.net/?mypy=1.6.1&python=3.11&gist=e282d121f479fcb77ec89daeb2a07b60
Expected Behavior
Should pass
Actual Behavior
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: