-
-
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
Fix inference for attrs.fields #15688
Conversation
for more information, see https://pre-commit.ci
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I don't think this is a hack. This is more consistent with e.g. tuple_fallback()
than the current behavior: tuple_fallback()
just returns the fallback if it is non-trivial, so here too, we should just copy the logic for instances, if the fallback is non-trivial.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This e.g. makes sure both code paths receive my fix in python#15688
This e.g. makes sure both code paths receive my fix in #15688
Fixes #15393. A little hacky, but not an unreasonable way of providing type context.