Skip to content

[3.13] GH-115869: Make jit_stencils.h reproducible (GH-127166) - #154988

Merged
Yhg1s merged 1 commit into
python:3.13from
bmwiedemann:gh115869
Aug 4, 2026
Merged

Yhg1s merged 1 commit into
python:3.13from
bmwiedemann:gh115869

Conversation

@bmwiedemann

@bmwiedemann bmwiedemann commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

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 17c16ae)

I tested that it works.

This PR was done while working on reproducible builds for openSUSE.

@mcepl mcepl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense to me.

…7166)

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 17c16ae)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
@Yhg1s
Yhg1s merged commit 9b67007 into python:3.13 Aug 4, 2026
52 of 54 checks passed
@bmwiedemann
bmwiedemann deleted the gh115869 branch August 6, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants