[3.14] gh-138061: Exclude __pycache__ directory from the computed digest in the JIT stencils (GH-138131) (#142482)

Co-authored-by: alm <alonme@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2025-12-09 19:18:14 +01:00 committed by GitHub
parent dafac8a47a
commit 8cb65ca1dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -0,0 +1 @@
Ensure reproducible builds by making JIT stencil header generation deterministic.

View file

@ -69,6 +69,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()