-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update email.utils
for 3.13
#12336
Update email.utils
for 3.13
#12336
Conversation
stdlib/email/utils.pyi
Outdated
def parseaddr(addr: str | None) -> tuple[str, str]: ... | ||
|
||
if sys.version_info >= (3, 13): | ||
def parseaddr(addr: str, *, strict: bool = True) -> tuple[str, str]: ... |
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.
None
works, since parseaddr
is designed to handle malformed inputs, but I don't it makes sense to accepr for either the new or old definition, to avoid mistakes.
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.
Seems like it also explicitly supports lists: https://github.com/python/cpython/blob/b5805892d55e769335c11a994b586355720263ba/Lib/email/utils.py#L341
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.
let me fix that.
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.
Actually - I'm not sure we want to add that. It just seems to be trying to handle the most flexible input possible, no?
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.
We should add back None
in that case as well I would say, if we really want to be true to every value it can accept at runtime.
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.
It does also have a thing where it returns ('', '')
for any non-str input, but this is a different check. I think we should add list[str]
because it has specific handling for this type.
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.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
No description provided.