Expand payload types for `email.message.Message.set_payload`
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读第 335-353 行附近的 Lib/email/message.py,以及 #134759 和 #136071 中链接的讨论。确定受支持的 payload 类型,并更新 typeshed 中 email.message.Message 的 typing;当类型决策得到解决,并且运行时行为和注解都反映该决策时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100