-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
attrs.evolve: support generics and unions #15050
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
attrs.evolve: support generics and unions #15050
Conversation
be7ae9b to
aed08ca
Compare
8c976f8 to
b32252f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
6721b51 to
8c90ab3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@hauntsaninja since you also reviewed #15022 I looked into existing code (checkmember, meet) but didn't find anything that did quite that, but |
|
👋 @hauntsaninja (trying to make it more readable, but it's really not too scary) |
This comment has been minimized.
This comment has been minimized.
857c624 to
10d9e91
Compare
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
hauntsaninja
left a comment
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.
Overall seems reasonable, could you also add a test case for constrained type variables?
I believe there's already |
hauntsaninja
left a comment
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.
Thank you!
Fixes
attrs.evolvesignature generation to support theinstparameter beingIn the case of unions, we "meet" the fields of the potential attrs classes, so that the resulting signature is the lower bound.
Fixes #15088.