From 7621bbd828bb42e3b54aae45bd33563cfa9e5ccb Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 9 Dec 2025 19:50:53 +0100 Subject: [PATCH] [3.14] gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455) (#142485) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455) (cherry picked from commit bcf90de8ba2ea087540a5f632656ef880ee46b5c) Co-authored-by: Miro HronĨok Co-authored-by: Ken Jin --- .../next/Build/2025-12-09-13-33-46.gh-issue-142454.cqUxzQ.rst | 4 ++++ Tools/jit/_targets.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2025-12-09-13-33-46.gh-issue-142454.cqUxzQ.rst diff --git a/Misc/NEWS.d/next/Build/2025-12-09-13-33-46.gh-issue-142454.cqUxzQ.rst b/Misc/NEWS.d/next/Build/2025-12-09-13-33-46.gh-issue-142454.cqUxzQ.rst new file mode 100644 index 00000000000..4de16866f28 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-12-09-13-33-46.gh-issue-142454.cqUxzQ.rst @@ -0,0 +1,4 @@ +When calculating the digest of the JIT stencils input, sort the hashed files +by filenames before adding their content to the hasher. This ensures +deterministic hash input and hence deterministic hash, independent on +filesystem order. diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index d7c9aed1191..f1085cc9bf0 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -72,7 +72,7 @@ def _compute_digest(self) -> str: # Exclude cache files from digest computation to ensure reproducible builds. if dirpath.endswith("__pycache__"): continue - for filename in filenames: + for filename in sorted(filenames): hasher.update(pathlib.Path(dirpath, filename).read_bytes()) return hasher.hexdigest()