KEMBAR78
Make imprecise constraints handling more robust by ilevkivskyi · Pull Request #16502 · python/mypy · GitHub
Skip to content

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().

@github-actions
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
@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