-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Make various email.Policy
use sites generic over the message type
#13274
Make various email.Policy
use sites generic over the message type
#13274
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The overloads in |
I just started getting a mypy error that I think is caused by the same issue, but it doesn't look like this PR touches Error:
Code:
|
mypy 1.15.0 also complains about Le mieux est l'ennemi du bien. |
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.
Thanks!
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Fixes #13273
email.Policy
was made generic in #12724. A bunch of places where its used don't provide an explicit type argument and use the default argument ofMessage
. However, sinceemail.Policy
is invariant in the message type, this causes problems when trying to passPolicy
instances that use subtypes ofMessage
.This PR makes various places where
email.Policy
is used generic in the message type, allowing the message type to be inferred instead of always defaulting toMessage
.For context: