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
This commit is contained in:
alm 2025-08-31 00:21:25 +03:00 committed by GitHub
parent f58a7c7175
commit d3d94e0ed7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -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()