We have run out of flags bits in `PyTypeObject`'s `tp_flags`
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
PyTypeObject's tp_flags field is defined as an unsigned long. In effect this means that we have only 32 bits we can use for flags. We have already used all 32 of them.
Bits 15 and 16 are reserved for Stackless Python. Since Stackless Python is pining for the fjords, we could recycle those two bits. However that's not going to last long with likely changes necessary for parallelism and performance.
Any change to PyTypeObject breaks both API and ABI, but that's OK because:
- Adding a field or changing the size of a field is a backwards compatible API change.
- The existence of
PyTypeObjectis part of the stable ABI, but its layout is not.
The cleanest change, IMO, is to change unsigned long tp_flags to uint64_t tp_flags which gives us another 32 bits, which should last many more years.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先從 PyTypeObject 的定義及其 tp_flags 欄位的所有使用處開始,然後根據所述的 API 和 ABI 限制評估提議的寬度變更。完成的標準是達成並實作一項擴充可用 flag 位元的共識設計,並處理受影響的介面和相容性行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- backend
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100