Skip to content

Expand payload types for email.message.Message.set_payload #136397

Open
@skv0zsneg

Description

@skv0zsneg

Feature or enhancement

Proposal:

While working on bug in PR #136071 we (me and @picnixz) discussed that set_payload of email.message.Message method could use list, str, bytes or handle buffer objects as payload to set.

For now it using duck type for objects with decode and encode methods. https://github.com/python/cpython/blob/main/Lib/email/message.py#L335-L353

I guess we need to decide necessary of it and if so the types that need to be support. Also update typing in typeshed for email.message.Message

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

#134759
#136071

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-emailtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions