When comparing the pre-built JIT stencils for identity, exclude the checksum

When autoconf was updated from 2.72 to 2.73, we observed a change in the checksum:

    + diff -u /builddir/build/SOURCES/Python-3.15.0a7-x86_64-debug-jit_stencils.h build/debug/jit_stencils-x86_64-unknown-linux-gnu.h
    --- /builddir/build/SOURCES/Python-3.15.0a7-x86_64-debug-jit_stencils.h	2026-03-10 00:00:00.000000000 +0000
    +++ build/debug/jit_stencils-x86_64-unknown-linux-gnu.h	2026-03-31 21:12:53.391262973 +0000
    @@ -1,4 +1,4 @@
    -// 5e1dc452d67c20147c4ea13e692c2d3e7b0b47b24f8847354c58988c7ffa02bc
    +// c783e3946f774d4d83e8fdcca35678ec77006e1b96b12661fcbd3ee680d10e94
     // $ python3.14 /builddir/build/BUILD/python3.14-3.15.0_a7-build/Python-3.15.0a7/Tools/jit/build.py x86_64-redhat-linux-gnu --output-dir . --pyconfig-dir . --cflags= --llvm-version= --debug

     void
    error: Bad exit status from /var/tmp/rpm-tmp.G15BYi (%check)

The autoconf-generated pyconfig.h file is part of the checksum input:
https://github.com/python/cpython/blob/v3.15.0a8/Tools/jit/_targets.py#L75

Generally, the reason for this checksum is to prevent outdated JIT stencils
when Python is re-configured with different options
(or when the stencils generation code is updated).

As suspected, the change in checksum was caused by a change in pyconfig.h:

    --- pyconfig.h
    +++ pyconfig.h
    @@ -1882,6 +1882,10 @@
     #ifndef _ALL_SOURCE
     # define _ALL_SOURCE 1
     #endif
    +/* Enable extensions on Cosmopolitan Libc. */
    +#ifndef _COSMO_SOURCE
    +# define _COSMO_SOURCE 1
    +#endif
     /* Enable general extensions on macOS.  */
     #ifndef _DARWIN_C_SOURCE
     # define _DARWIN_C_SOURCE 1

This is expected, see https://cgit.git.savannah.gnu.org/cgit/autoconf.git/tree/NEWS?h=v2.73#n99

tl;dr when a new autoconf version changes the output of pyconfig.h, the checksum changes as well.

We cannot update the pre-built stencils with the new checksum
because that would make the build fail with older autoconf.

Instead, we ignore the checksum in this check. We care for the contents, not checksums.

Cherry-picked from python3.15 commit aab847c347b141083dbfbcf33fb38fb286dc2f62
This commit is contained in:
Miro Hrončok 2026-04-14 14:08:05 +02:00
commit f45779a0aa

View file

@ -1498,7 +1498,8 @@ done
%if %{with jit_build_stencils}
for ConfName in %{?with_debug_build:debug} optimized; do
if [ -s %{jit_stencils_source} ]; then
diff -u %{jit_stencils_source} build/${ConfName}/%{jit_stencils_filename}
# The -I option ignores the checksum line (calculated from files incl. pyconfig.h which may change with new autoconf)
diff -u -I '^// [0-9a-f]\{64\}$' %{jit_stencils_source} build/${ConfName}/%{jit_stencils_filename}
else
echo "%{jit_stencils_source} is empty, not checking if it is up to date"
fi