mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
[3.14] gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455) (#142485)
gh-142454: Make the JIT digest more deterministic by sorting the files in Tools/jit (GH-142455)
(cherry picked from commit bcf90de8ba)
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
This commit is contained in:
parent
8cb65ca1dd
commit
7621bbd828
2 changed files with 5 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue