python / python/cpython

Allow ABCMeta in PyType_FromMetaclass

オープン
#137,770 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

interpreter-core topic-C-API type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、PyType_FromMetaclass と、ネイティブメソッドを抽象としてマークする既存のロジックを特定します。ABCMeta とそのサブタイプが tp_new をどのように処理し、abstractmethods がどのように計算されるかを追跡します。ABCMeta 互換のメタクラスが受け入れられ、抽象フラグと計算の動作が維持されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, python
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。