ShareableList removes trailing zeroes from strings and bytes
未關閉
還沒有人認領這個 Issue。
topic-multiprocessing
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
from multiprocessing.shared_memory import ShareableList
s, b = '\x00\x01\x00', bytes([0,1,0])
sl = ShareableList([s, b])
s == sl[0], b == sl[1]
gives (False, False) because the trailing zeroes get lost in the ShareableList: sl holds ShareableList(['\x00\x01', b'\x00\x01'], name='wnsm_...'). I would expect that strings and bytes keep the trailing zeroes also when added to a ShareableList.
Your environment
- CPython versions tested on: 3.8.5, 3.10.6
- Operating system and architecture: Windows 10, 64bit
Analysis
There are three places in class ShareableList in Lib/multiprocessing/shared_memory.py, where trailing zeroes are explicitely removed: ...rstrip(b'\x00').... For what reason?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Lib/multiprocessing/shared_memory.py 開始,檢查使用 rstrip(b'\x00') 的三個 ShareableList 位置;重現提供的範例以確認此行為。完成的標準是字串和 bytes 保留結尾的零,同時現有的 ShareableList 行為維持不變,並在專案中此進入點對應的測試所在位置加入迴歸覆蓋率。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- operating-systems
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 48/100