Skip to content

fix: use Self to ensure correct return type for EmailPolicy cloning #10301

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 1 commit into from
Jun 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stdlib/email/policy.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from email.errors import MessageDefect
from email.header import Header
from email.message import Message
from typing import Any
from typing_extensions import Self

__all__ = ["Compat32", "compat32", "Policy", "EmailPolicy", "default", "strict", "SMTP", "HTTP"]

Expand All @@ -25,7 +26,7 @@ class Policy(metaclass=ABCMeta):
mangle_from_: bool = ...,
message_factory: Callable[[Policy], Message] | None = ...,
) -> None: ...
def clone(self, **kw: Any) -> Policy: ...
def clone(self, **kw: Any) -> Self: ...
def handle_defect(self, obj: Message, defect: MessageDefect) -> None: ...
def register_defect(self, obj: Message, defect: MessageDefect) -> None: ...
def header_max_count(self, name: str) -> int | None: ...
Expand Down