Skip to content

Commit 08b9e2c

Browse files
committed
fix: add PGO exclusions for musl base and update profile task for Python builds
1 parent 76b646d commit 08b9e2c

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

3.14t/x86/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,14 @@ COPY --from=zstd_builder /opt/shared_libraries /opt/shared_libraries
146146

147147
# =========== Python ===========
148148
FROM deps_merged AS python_builder
149+
# EXTRA_PGO_EXCLUDES: drop test_struct from the PGO profile task. Its
150+
# test_endian_table_init_subinterpreters races on importlib._bootstrap_external
151+
# ._fill_cache() during concurrent subinterpreter import on free-threaded
152+
# builds (upstream gh-140260 / gh-142414). Remove when the fix lands in a
153+
# 3.14.x point release.
149154
ENV PYTHON_VERSION=3.14.4 \
150155
DISABLE_GIL=1 \
156+
EXTRA_PGO_EXCLUDES=test_struct \
151157
PYTHON_PIP_VERSION=26.0.1 \
152158
PYTHON_SETUPTOOLS_VERSION=82.0.1
153159

3.14t/x86_64/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,14 @@ COPY --from=zstd_builder /opt/shared_libraries /opt/shared_libraries
146146

147147
# =========== Python ===========
148148
FROM deps_merged AS python_builder
149+
# EXTRA_PGO_EXCLUDES: drop test_struct from the PGO profile task. Its
150+
# test_endian_table_init_subinterpreters races on importlib._bootstrap_external
151+
# ._fill_cache() during concurrent subinterpreter import on free-threaded
152+
# builds (upstream gh-140260 / gh-142414). Remove when the fix lands in a
153+
# 3.14.x point release.
149154
ENV PYTHON_VERSION=3.14.4 \
150155
DISABLE_GIL=1 \
156+
EXTRA_PGO_EXCLUDES=test_struct \
151157
PYTHON_PIP_VERSION=26.0.1 \
152158
PYTHON_SETUPTOOLS_VERSION=82.0.1
153159

common/build/deplib/build_python.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,33 @@ if [ "${DISABLE_GIL:-0}" = "1" ]; then
4848
CONFIGURE_EXTRA="--disable-gil"
4949
fi
5050

51+
# PGO exclusions for the musl (Alpine) base. The default PROFILE_TASK from
52+
# configure.ac is `-m test --pgo --timeout=$(TESTTIMEOUT)`; we append -x
53+
# flags for tests that fail during profile generation because of musl
54+
# limitations rather than CPython regressions. Alpine aports follows the
55+
# same pattern (their ppc64le branch excludes `test_time`) but handles
56+
# musl locale breakage in post-build `check()` only because they never
57+
# build 3.13 or free-threaded. We must handle it at PGO time.
58+
#
59+
# test_re: test_locale_caching / test_locale_compiled assume iso8859-1
60+
# case-folding works. musl's LC_CTYPE has no such locale data, so the
61+
# case-insensitive match of `\xc5` ~ `\xe5` fails. Alpine's own check()
62+
# skips the whole test_re module on musl for the same reason. 3.12 passed
63+
# by accident because Modules/_sre/sre.c called libc `tolower` directly;
64+
# 3.13 routes through a `sre_tolower` wrapper that exposes the musl gap.
65+
PGO_EXCLUDES="test_re"
66+
67+
# Per-Dockerfile opt-in for version-specific PGO breakage. Used by 3.14t
68+
# to skip test_struct.test_endian_table_init_subinterpreters, which races
69+
# on importlib._bootstrap_external._fill_cache() under concurrent
70+
# subinterpreter import (upstream gh-140260 / gh-142414). Remove the ENV
71+
# once the upstream fix lands in a 3.14.x point release.
72+
if [ -n "${EXTRA_PGO_EXCLUDES:-}" ]; then
73+
PGO_EXCLUDES="${PGO_EXCLUDES} ${EXTRA_PGO_EXCLUDES}"
74+
fi
75+
76+
export PROFILE_TASK="-m test --pgo --timeout=\$(TESTTIMEOUT) -x ${PGO_EXCLUDES}"
77+
5178
./configure --build="$gnuArch" --enable-loadable-sqlite-extensions \
5279
--enable-optimizations --enable-option-checking=fatal --enable-shared \
5380
--with-lto --with-system-expat --without-ensurepip \

0 commit comments

Comments
 (0)