Add a way to ignore JIT stencil digest
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Feature or enhancement
Proposal:
In Fedora, we use prebuilt JIT stencils on some of the Fedora versions/editions.
When autoconf was updated from 2.72 to 2.73 in Fedora Rawhide, we observed a change in the checksum:
--- /builddir/build/SOURCES/Python-3.15.0a7-x86_64-debug-jit_stencils.h 2026-03-10 00:00:00.000000000 +0000
+++ build/debug/jit_stencils-x86_64-unknown-linux-gnu.h 2026-03-31 21:12:53.391262973 +0000
@@ -1,4 +1,4 @@
-// 5e1dc452d67c20147c4ea13e692c2d3e7b0b47b24f8847354c58988c7ffa02bc
+// c783e3946f774d4d83e8fdcca35678ec77006e1b96b12661fcbd3ee680d10e94
// $ python3.14 /builddir/build/BUILD/python3.14-3.15.0_a7-build/Python-3.15.0a7/Tools/jit/build.py x86_64-redhat-linux-gnu --output-dir . --pyconfig-dir . --cflags= --llvm-version= --debug
The autoconf-generated pyconfig.h file is part of the checksum input:
https://github.com/python/cpython/blob/v3.15.0a8/Tools/jit/_targets.py#L75
My understanding is that the reason for this checksum check is to prevent outdated JIT stencils when Python is re-configured with different options (or when the stencils generation code is updated).
As suspected, the change in checksum was caused by a change in pyconfig.h:
--- pyconfig.h
+++ pyconfig.h
@@ -1882,6 +1882,10 @@
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
+/* Enable extensions on Cosmopolitan Libc. */
+#ifndef _COSMO_SOURCE
+# define _COSMO_SOURCE 1
+#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# define _DARWIN_C_SOURCE 1
This is expected, see https://cgit.git.savannah.gnu.org/cgit/autoconf.git/tree/NEWS?h=v2.73#n99
tl;dr When a new autoconf version changes the output of pyconfig.h, the checksum changes as well.
We cannot update the pre-built stencils with the new checksum because that would make the build fail with older autoconf.
Hence, I am proposing we have a way to instruct the Tools/jit/_targets.py tool to ignore checksum mismatch. We would then use this option in Fedora.
For example, ./configure --enable-prebuilt-jit-stencils.
I will open a draft PR for consideration. Thanks.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
What we do in Fedora was previously discussed in https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838
Linked PRs
- gh-148647
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Tools/jit/_targets.py 和現有的 --enable-prebuilt-jit-stencils 提案開始,然後檢閱連結的草稿 PR gh-148647。驗證校驗和如何包含 pyconfig.h,並定義當預先建置的 stencil 來自不同的 autoconf 版本時應有何種行為。完成的標準是 Fedora 可以選擇退出不相符失敗,同時不削弱預設保護。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- build-system
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100