compileall doesn't recompile when invalidation mode changes even if timestamps match
未關閉
還沒有人認領這個 Issue。
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
λ rm -rf __pycache__ 130
λ python -m compileall x.py --invalidation-mode timestamp
Compiling 'x.py'...
λ python -m compileall x.py --invalidation-mode timestamp
λ python -m compileall x.py --invalidation-mode checked-hash
λ python
>>> import importlib.util
>>> with open("__pycache__/x.cpython-311.pyc", "rb") as f:
... d = f.read()
...
>>> d[:4]
b'\xa7\r\r\n'
>>> d[4:8]
b'\x00\x00\x00\x00'
λ rm -rf __pycache__
λ python -m compileall x.py --invalidation-mode checked-hash
Compiling 'x.py'...
λ python
>>> with open("__pycache__/x.cpython-311.pyc", "rb") as f:
... d = f.read()
...
>>> d[:4]
b'\xa7\r\r\n'
>>> d[4:8]
b'\x03\x00\x00\x00'
CPython versions tested on:
3.11
Operating systems tested on:
No response
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 python -m compileall 透過 x.py 重現該行為,並檢查 pycache 中產生的檔案。從 compileall 命令進入點開始,比較使用 timestamp 和 checked-hash 的重複執行。完成的標準是:變更失效模式會導致重新編譯,或以其他方式更新 pyc 標頭,即使 timestamp 相符也是如此。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- build-system, tooling
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100