Skip to content
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

Make imprecise constraints handling more robust #16502

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

ilevkivskyi
Copy link
Member

Fixes #16485

My initial implementation of imprecise constraints fallback was really fragile and ad-hoc, and I now see several edge case scenarios where we may end up using imprecise constraints for a ParamSpec while some precise ones are available. So I re-organized it: now we just infer everything as normally, and filter out imprecise (if needed) at the very end, when we have the full picture. I also fix an accidental omission in expand_type().

Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@ilevkivskyi ilevkivskyi changed the title Make imprecise contraints handling more robust Make imprecise constraints handling more robust Nov 16, 2023
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new logic looks strictly better than the old one.

@JukkaL JukkaL merged commit 3e6b552 into python:master Nov 22, 2023
18 checks passed
@ilevkivskyi ilevkivskyi deleted the fix-imprecise-kinds branch November 22, 2023 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy 1.7.0, ParamSpec: Cannot infer type argument 1 of "function_name" when using keyword arguments.
2 participants