Proposal to add gc_list_for_each macro
オープン
まだ誰も着手していません。
interpreter-core
pending
type-feature
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Feature or enhancement
Proposal:
In the implementation of the reference cycle garbage collector, gc.c file, I have noticed that we use the following for-loop pattern over and over to traverse a PyGC_Head list:
for (gc = GC_NEXT(list); gc != list; gc = GC_NEXT(gc)) {
/* ... */
}
However, in pycore_llist.h we avoided that by using llist_for_each macro as:
// Iterate over a list.
#define llist_for_each(node, head) \
for (node = (head)->next; node != (head); node = node->next)
I propose adding a new macro as gc_list_for_each to the gc_list_xxx family to serve the same purpose:
#define gc_list_for_each(gc, list) \
for (gc = GC_NEXT((list)); gc != (list); gc = GC_NEXT(gc))
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、gc.c にある PyGC_Head の繰り返し走査パターンと、pycore_llist.h にある既存の llist_for_each マクロを確認します。提案されている gc_list_for_each マクロを gc_list_xxx ファミリーに追加し、参照サイクルのガベージコレクターが引き続きビルドでき、既存の動作に変更がないことを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c
- 領域
- backend
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 48/100