python / python/cpython

Expand payload types for `email.message.Message.set_payload`

未關閉
#136,397 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

stdlib topic-email type-feature
主要語言
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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 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

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。