Typeshed in mypy 1.14.0 prohibits using email.policy.default
with email.message_from_string()
#13273
Open
Description
(I'm not sure whether this is a mypy bug or a typeshed bug, but the mypy issue template says that problems with specific functions should be reported here, so ...)
Consider the following code:
from email import message_from_string, policy
with open("message.eml") as fp:
source = fp.read()
msg = message_from_string(source, policy=policy.default)
I think it's clear that this code should be acceptable, but running mypy 1.14.0 on this produces the following error:
email-policy.py:6: error: Argument "policy" to "message_from_string" has incompatible type "EmailPolicy[EmailMessage]"; expected "Policy[Message[str, str]]" [arg-type]
Metadata
Assignees
Labels
No labels