Allow ABCMeta in PyType_FromMetaclass
未關閉
還沒有人認領這個 Issue。
interpreter-core
topic-C-API
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Feature or enhancement
Proposal:
Currently Python 3.14 will deny any metaclass that implements tp_new, which ABCMeta does.
My suggestion is to add special logic in PyType_FromMetaclass that if the metaclass is ABCMeta or a subtype uses its tp_new instead of custom that it adds the abstract flag, and calls the method that calculates abstractmethods attribute.
Currently there is logic in CPython to mark native methods as abstract.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先定位 PyType_FromMetaclass 以及將原生方法標記為抽象方法的現有邏輯。追蹤 ABCMeta 及其子型別如何處理 tp_new,以及如何計算 abstractmethods。完成的標準是接受與 ABCMeta 相容的中繼類別,同時保留抽象標誌和計算行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- c, python
- 領域
- backend
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100