https://github.com/python/cpython/commit/d3d94e0ed715829d9bf93ef9c35e04832962f19f
commit: d3d94e0ed715829d9bf93ef9c35e04832962f19f
branch: main
author: alm <[email protected]>
committer: diegorusso <[email protected]>
date: 2025-08-30T22:21:25+01:00
summary:
gh-138061: Exclude __pycache__ directory from the computed digest in the JIT
stencils (#138131)
Exclude the __pycache__ directory when generating the digest in the JIT stencils
files:
A Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst
M Tools/jit/_targets.py
diff --git
a/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst
b/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst
new file mode 100644
index 00000000000000..7af79d0b87ef55
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst
@@ -0,0 +1 @@
+Ensure reproducible builds by making JIT stencil header generation
deterministic.
diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
index 7e261c9f8e297f..c3ce24643fd4a6 100644
--- a/Tools/jit/_targets.py
+++ b/Tools/jit/_targets.py
@@ -71,6 +71,9 @@ def _compute_digest(self) -> str:
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)):
+ # Exclude cache files from digest computation to ensure
reproducible builds.
+ if dirpath.endswith("__pycache__"):
+ continue
for filename in filenames:
hasher.update(pathlib.Path(dirpath, filename).read_bytes())
return hasher.hexdigest()
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]