-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
email.message_from_bytes etc return legacy Message objects, not EmailMessage #10762
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
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This also applies to the return types of the different We should consider making the |
(FYI, @fsc-eriker, I transferred this issue from CPython since CPython itself has no type hints; all type hints for the standard library are found here, in the typeshed repo :) |
#10769 is a first step by making policies generic. |
Uh oh!
There was an error while loading. Please reload this page.
When you run MyPy on code which requires an EmailMessage, you often get errors.
Running
mypy
on this file gets meYou can obviously work around this with a
cast
or etc; but perhaps the default for these methods should be changed to return anEmailMessage
, and require a cast if you need the legacyMessage
type instead?I get similar behavior with
email_from_bytes
etc; all of these functions for producing anEmailMessage
object from the RFC5322 representation of an actual message have an API which (obscurely!) depends on the presence of thepolicy=
argument for whether to return anEmailMessage
or a legacyMessage
.The text was updated successfully, but these errors were encountered: