]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138061: Exclude __pycache__ directory from the computed digest in the JIT stencil...
authoralm <alonme@users.noreply.github.com>
Sat, 30 Aug 2025 21:21:25 +0000 (00:21 +0300)
committerGitHub <noreply@github.com>
Sat, 30 Aug 2025 21:21:25 +0000 (22:21 +0100)
Exclude the __pycache__ directory when generating the digest in the JIT stencils

Misc/NEWS.d/next/Build/2025-08-27-09-52-45.gh-issue-138061.fMVS9w.rst [new file with mode: 0644]
Tools/jit/_targets.py

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 (file)
index 0000000..7af79d0
--- /dev/null
@@ -0,0 +1 @@
+Ensure reproducible builds by making JIT stencil header generation deterministic.
index 7e261c9f8e297fab3ae8b4b10f6d0b0195274bb1..c3ce24643fd4a687fbc150954adf0538ec4e0570 100644 (file)
@@ -71,6 +71,9 @@ class _Target(typing.Generic[_S, _R]):
         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()