From 8cb65ca1dd7c63e45cfba9a07459cbaea8a6f571 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 9 Dec 2025 19:18:14 +0100 Subject: [PATCH] [3.14] gh-138061: Exclude __pycache__ directory from the computed digest in the JIT stencils (GH-138131) (#142482) Co-authored-by: alm --- .../next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst | 1 + Tools/jit/_targets.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst 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 00000000000..7af79d0b87e --- /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 ed63e388e43..d7c9aed1191 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -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()