Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Clean up and fix email message types #13532

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

Merged
merged 11 commits into from
May 5, 2025
Merged

Clean up and fix email message types #13532

merged 11 commits into from
May 5, 2025

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Feb 24, 2025

  • Unify the _MessageT type var in email._policybase.
  • Use explicit type arguments for Message type in _MessageT type var.
    In particular, change bound from Message[str, str] to Message[Any, Any].
  • Change __init__() overloads of Parser and BytesParser to accept
    Message objects that are not Message[str, str] if _class is not also given.

Closes: #13531

srittau and others added 4 commits February 24, 2025 17:20
* Unify the `_MessageT` type var in `email._policybase`.
* Use explicit type arguments for `Message` type in `_MessageT` type var.
  In particular, change bound from `Message[str, str]` to `Message[Any, Any]`.
* Change `__init__()` overloads of `Parser` and `BytesParser` to accept
  `Message` objects that are not `Message[str, str]` if `_class` is not also given.

Closes: python#13531
@srittau srittau changed the title Clean up email message types Clean up and fix email message types Feb 24, 2025

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented May 5, 2025

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@Avasam Avasam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside the _MessageT move these changes are actually quite simple.

Tests checks out. No negative primer impact. Code changes LGTM.

Good to merge.

@Avasam Avasam merged commit 0eb44e5 into python:main May 5, 2025
55 checks passed
@srittau srittau deleted the email-policy branch May 5, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

email.policy.default doesn't work with email.parser.BytesParser or email.parser.Parser
2 participants