[3.13] GH-115869: Make jit_stencils.h reproducible (GH-127166) (#154988)
Yhg1s <[email protected]> Tue, 04 Aug 2026 05:00:14 -0400 (EDT)
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/9b670079496f3824b5d58da320734ae30f26a355 commit: 9b670079496f3824b5d58da320734ae30f26a355 branch: 3.13 author: Bernhard M. Wiedemann <[email protected]> committer: Yhg1s <[email protected]> date: 2026-08-04T10:59:51+02:00 summary: [3.13] GH-115869: Make jit_stencils.h reproducible (GH-127166) (#154988) Keep the build tmpdir out of jit_stencils.h llvm-objdump prints the path of the object file it disassembles, and the JIT builds every stencil in a fresh tempfile.TemporaryDirectory(). That random path ended up verbatim in the disassembly comments of the generated jit_stencils.h, so two builds of the same source never produced the same header: // /tmp/tmp164olvmi/_BINARY_OP.o: file format elf64-x86-64 +// /tmp/tmpmufvewt2/_BINARY_OP.o: file format elf64-x86-64 Replace the full path with the bare file name. Only the _parse() hunk of that commit is taken here; the rest of it depends on refactorings that are not in 3.13. (cherry picked from commit 17c16aea66b606d66f71ae9af381bc34d0ef3f5f) Co-authored-by: Brandt Bucher <[email protected]> files: A Misc/NEWS.d/next/Build/2024-11-22-08-46-46.gh-issue-115869.UVLSKd.rst M Tools/jit/_targets.py diff --git a/Misc/NEWS.d/next/Build/2024-11-22-08-46-46.gh-issue-115869.UVLSKd.rst b/Misc/NEWS.d/next/Build/2024-11-22-08-46-46.gh-issue-115869.UVLSKd.rst new file mode 100644 index 000000000000000..9e8a078983f20b5 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2024-11-22-08-46-46.gh-issue-115869.UVLSKd.rst @@ -0,0 +1 @@ +Make ``jit_stencils.h`` (which is produced during JIT builds) reproducible. diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index c50bd63545c2fe4..55f2332136cba92 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -65,8 +65,10 @@ async def _parse(self, path: pathlib.Path) -> _stencils.StencilGroup: args = ["--disassemble", "--reloc", f"{path}"] output = await _llvm.maybe_run("llvm-objdump", args, echo=self.verbose) if output is not None: + # Make sure that full paths don't leak out (for reproducibility): + long, short = str(path), str(path.name) group.code.disassembly.extend( - line.expandtabs().strip() + line.expandtabs().strip().replace(long, short) for line in output.splitlines() if not line.isspace() ) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]