python / python/cpython

The IDENTIFIERS list in Tools/scripts/generate_global_objects.py is a slight burden

未關閉
#94,715 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

interpreter-core type-feature
主要語言
Python
星號
77.2k
分支
36k
平均合併
1 天 9 小時
30 天內合併 PR
558

描述

(This is partly inspired by gh-94706.)

In generate_global_objects.py, iter_global_strings() detects global strings by looking for _Py_ID() and _Py_DECLARE_STR() in the C source files. In some places those macros are used indirectly, which means the corresponding strings won't be detected by iter_global_strings().

Currently we manually add such strings to the IDENTIFIERS list at the top of the script. Before we added the discovery mechanism in iter_global_strings(), basically all the static strings were in this list. However, we found that there were several maintenance/development downsides to the manual list, so we added iter_global_strings(). At the time we didn't take the extra step of automating discovery of indirectly used names. We should address this.

CC @kumaraditya303

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Tools/scripts/generate_global_objects.py 開始,著重於 iter_global_strings() 和手動維護的 IDENTIFIERS 清單。追蹤腳本如何掃描 C 原始碼檔案以尋找 _Py_ID() 和 _Py_DECLARE_STR(),然後判定如何找出間接使用的名稱。完成的標準是:間接使用的全域字串不再需要手動新增,同時產生程序仍然正確。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
c, python
領域
build-system, tooling
Issue 類型
重構
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。