Skip to content

Commit 0daef66

Browse files
alonmelkollar
authored andcommitted
pythongh-138061: Exclude __pycache__ directory from the computed digest in the JIT stencils (python#138131)
Exclude the __pycache__ directory when generating the digest in the JIT stencils
1 parent 929810e commit 0daef66

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure reproducible builds by making JIT stencil header generation deterministic.

Tools/jit/_targets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ def _compute_digest(self) -> str:
7171
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
7272
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
7373
for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)):
74+
# Exclude cache files from digest computation to ensure reproducible builds.
75+
if dirpath.endswith("__pycache__"):
76+
continue
7477
for filename in filenames:
7578
hasher.update(pathlib.Path(dirpath, filename).read_bytes())
7679
return hasher.hexdigest()

0 commit comments

Comments
 (0)