Skip to content

Conversation

@tianon
Copy link
Member

@tianon tianon commented Jan 24, 2025

Changes:

Changes:

- docker-library/python@dbda0feb: Merge pull request docker-library/python#1000 from artizirk/frame-pointers
@github-actions
Copy link

Diff for b3835ce:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 24d5aca..5a17af0 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -97,33 +97,33 @@ Directory: 3.11/slim-bullseye
 
 Tags: 3.12.8-alpine3.20, 3.12-alpine3.20
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 23c83c5a82646e123df33d056f7dfbe1d78cfc8b
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.12/alpine3.20
 
 Tags: 3.12.8-alpine3.21, 3.12-alpine3.21, 3.12.8-alpine, 3.12-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3d7b328b66525fe2e82af7063af10c176b6ee8cd
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.12/alpine3.21
 
 Tags: 3.12.8-bookworm, 3.12-bookworm
 SharedTags: 3.12.8, 3.12
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 23c83c5a82646e123df33d056f7dfbe1d78cfc8b
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.12/bookworm
 
 Tags: 3.12.8-bullseye, 3.12-bullseye
 Architectures: amd64, arm32v7, arm64v8, i386
-GitCommit: 23c83c5a82646e123df33d056f7dfbe1d78cfc8b
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.12/bullseye
 
 Tags: 3.12.8-slim-bookworm, 3.12-slim-bookworm, 3.12.8-slim, 3.12-slim
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 23c83c5a82646e123df33d056f7dfbe1d78cfc8b
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.12/slim-bookworm
 
 Tags: 3.12.8-slim-bullseye, 3.12-slim-bullseye
 Architectures: amd64, arm32v7, arm64v8, i386
-GitCommit: 23c83c5a82646e123df33d056f7dfbe1d78cfc8b
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.12/slim-bullseye
 
 Tags: 3.12.8-windowsservercore-1809, 3.12-windowsservercore-1809
@@ -152,33 +152,33 @@ Constraints: windowsservercore-ltsc2025
 
 Tags: 3.13.1-alpine3.20, 3.13-alpine3.20, 3-alpine3.20, alpine3.20
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: da7ef3c71d3ecd87a43018a372b3e3590d88dd98
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.13/alpine3.20
 
 Tags: 3.13.1-alpine3.21, 3.13-alpine3.21, 3-alpine3.21, alpine3.21, 3.13.1-alpine, 3.13-alpine, 3-alpine, alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3d7b328b66525fe2e82af7063af10c176b6ee8cd
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.13/alpine3.21
 
 Tags: 3.13.1-bookworm, 3.13-bookworm, 3-bookworm, bookworm
 SharedTags: 3.13.1, 3.13, 3, latest
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: da7ef3c71d3ecd87a43018a372b3e3590d88dd98
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.13/bookworm
 
 Tags: 3.13.1-bullseye, 3.13-bullseye, 3-bullseye, bullseye
 Architectures: amd64, arm32v7, arm64v8, i386
-GitCommit: da7ef3c71d3ecd87a43018a372b3e3590d88dd98
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.13/bullseye
 
 Tags: 3.13.1-slim-bookworm, 3.13-slim-bookworm, 3-slim-bookworm, slim-bookworm, 3.13.1-slim, 3.13-slim, 3-slim, slim
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: da7ef3c71d3ecd87a43018a372b3e3590d88dd98
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.13/slim-bookworm
 
 Tags: 3.13.1-slim-bullseye, 3.13-slim-bullseye, 3-slim-bullseye, slim-bullseye
 Architectures: amd64, arm32v7, arm64v8, i386
-GitCommit: da7ef3c71d3ecd87a43018a372b3e3590d88dd98
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.13/slim-bullseye
 
 Tags: 3.13.1-windowsservercore-1809, 3.13-windowsservercore-1809, 3-windowsservercore-1809, windowsservercore-1809
@@ -207,33 +207,33 @@ Constraints: windowsservercore-ltsc2025
 
 Tags: 3.14.0a4-alpine3.20, 3.14-rc-alpine3.20
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 0bb5f4bc94265f7e9a0d116e1974e2926476baf0
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.14-rc/alpine3.20
 
 Tags: 3.14.0a4-alpine3.21, 3.14-rc-alpine3.21, 3.14.0a4-alpine, 3.14-rc-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 0bb5f4bc94265f7e9a0d116e1974e2926476baf0
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.14-rc/alpine3.21
 
 Tags: 3.14.0a4-bookworm, 3.14-rc-bookworm
 SharedTags: 3.14.0a4, 3.14-rc
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 0bb5f4bc94265f7e9a0d116e1974e2926476baf0
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.14-rc/bookworm
 
 Tags: 3.14.0a4-bullseye, 3.14-rc-bullseye
 Architectures: amd64, arm32v7, arm64v8, i386
-GitCommit: 0bb5f4bc94265f7e9a0d116e1974e2926476baf0
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.14-rc/bullseye
 
 Tags: 3.14.0a4-slim-bookworm, 3.14-rc-slim-bookworm, 3.14.0a4-slim, 3.14-rc-slim
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 0bb5f4bc94265f7e9a0d116e1974e2926476baf0
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.14-rc/slim-bookworm
 
 Tags: 3.14.0a4-slim-bullseye, 3.14-rc-slim-bullseye
 Architectures: amd64, arm32v7, arm64v8, i386
-GitCommit: 0bb5f4bc94265f7e9a0d116e1974e2926476baf0
+GitCommit: 5b0aaddf4f4e887cad27aee3ca99a0c698693c5a
 Directory: 3.14-rc/slim-bullseye
 
 Tags: 3.14.0a4-windowsservercore-1809, 3.14-rc-windowsservercore-1809
diff --git a/python_3.12-alpine/Dockerfile b/python_3.12-alpine/Dockerfile
index 4bc600f..ecfa2e5 100644
--- a/python_3.12-alpine/Dockerfile
+++ b/python_3.12-alpine/Dockerfile
@@ -84,6 +84,10 @@ RUN set -eux; \
 # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
 	EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.12-alpine3.20/Dockerfile b/python_3.12-alpine3.20/Dockerfile
index 734c041..738425f 100644
--- a/python_3.12-alpine3.20/Dockerfile
+++ b/python_3.12-alpine3.20/Dockerfile
@@ -84,6 +84,10 @@ RUN set -eux; \
 # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
 	EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.12-bookworm/Dockerfile b/python_3.12-bookworm/Dockerfile
index 1582f2c..03a5677 100644
--- a/python_3.12-bookworm/Dockerfile
+++ b/python_3.12-bookworm/Dockerfile
@@ -56,6 +56,10 @@ RUN set -eux; \
 	nproc="$(nproc)"; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.12-bullseye/Dockerfile b/python_3.12-bullseye/Dockerfile
index 4c29d1c..c50e64a 100644
--- a/python_3.12-bullseye/Dockerfile
+++ b/python_3.12-bullseye/Dockerfile
@@ -56,6 +56,10 @@ RUN set -eux; \
 	nproc="$(nproc)"; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.12-slim-bullseye/Dockerfile b/python_3.12-slim-bullseye/Dockerfile
index 1b0527a..cfc48bc 100644
--- a/python_3.12-slim-bullseye/Dockerfile
+++ b/python_3.12-slim-bullseye/Dockerfile
@@ -82,6 +82,10 @@ RUN set -eux; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.12-slim/Dockerfile b/python_3.12-slim/Dockerfile
index d5510b6..f2f30c0 100644
--- a/python_3.12-slim/Dockerfile
+++ b/python_3.12-slim/Dockerfile
@@ -82,6 +82,10 @@ RUN set -eux; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.14-rc-alpine/Dockerfile b/python_3.14-rc-alpine/Dockerfile
index 0f2357e..aef7089 100644
--- a/python_3.14-rc-alpine/Dockerfile
+++ b/python_3.14-rc-alpine/Dockerfile
@@ -72,6 +72,10 @@ RUN set -eux; \
 # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
 	EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.14-rc-alpine3.20/Dockerfile b/python_3.14-rc-alpine3.20/Dockerfile
index e8d8627..9ecd7cc 100644
--- a/python_3.14-rc-alpine3.20/Dockerfile
+++ b/python_3.14-rc-alpine3.20/Dockerfile
@@ -72,6 +72,10 @@ RUN set -eux; \
 # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
 	EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.14-rc-bookworm/Dockerfile b/python_3.14-rc-bookworm/Dockerfile
index a5daf96..87bcfdb 100644
--- a/python_3.14-rc-bookworm/Dockerfile
+++ b/python_3.14-rc-bookworm/Dockerfile
@@ -44,6 +44,10 @@ RUN set -eux; \
 	nproc="$(nproc)"; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.14-rc-bullseye/Dockerfile b/python_3.14-rc-bullseye/Dockerfile
index b869fcf..503461b 100644
--- a/python_3.14-rc-bullseye/Dockerfile
+++ b/python_3.14-rc-bullseye/Dockerfile
@@ -44,6 +44,10 @@ RUN set -eux; \
 	nproc="$(nproc)"; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.14-rc-slim-bullseye/Dockerfile b/python_3.14-rc-slim-bullseye/Dockerfile
index afc7b3f..d449c28 100644
--- a/python_3.14-rc-slim-bullseye/Dockerfile
+++ b/python_3.14-rc-slim-bullseye/Dockerfile
@@ -70,6 +70,10 @@ RUN set -eux; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_3.14-rc-slim/Dockerfile b/python_3.14-rc-slim/Dockerfile
index 3d51543..74ad70f 100644
--- a/python_3.14-rc-slim/Dockerfile
+++ b/python_3.14-rc-slim/Dockerfile
@@ -70,6 +70,10 @@ RUN set -eux; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_alpine/Dockerfile b/python_alpine/Dockerfile
index 47fda0d..2fb507f 100644
--- a/python_alpine/Dockerfile
+++ b/python_alpine/Dockerfile
@@ -79,6 +79,10 @@ RUN set -eux; \
 # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
 	EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_alpine3.20/Dockerfile b/python_alpine3.20/Dockerfile
index a3400bc..4782178 100644
--- a/python_alpine3.20/Dockerfile
+++ b/python_alpine3.20/Dockerfile
@@ -79,6 +79,10 @@ RUN set -eux; \
 # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0
 	EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_bookworm/Dockerfile b/python_bookworm/Dockerfile
index 7c10869..96f6389 100644
--- a/python_bookworm/Dockerfile
+++ b/python_bookworm/Dockerfile
@@ -51,6 +51,10 @@ RUN set -eux; \
 	nproc="$(nproc)"; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_bullseye/Dockerfile b/python_bullseye/Dockerfile
index 88fbc5f..d1a2581 100644
--- a/python_bullseye/Dockerfile
+++ b/python_bullseye/Dockerfile
@@ -51,6 +51,10 @@ RUN set -eux; \
 	nproc="$(nproc)"; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_slim-bullseye/Dockerfile b/python_slim-bullseye/Dockerfile
index 1afd616..d3a069c 100644
--- a/python_slim-bullseye/Dockerfile
+++ b/python_slim-bullseye/Dockerfile
@@ -77,6 +77,10 @@ RUN set -eux; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \
diff --git a/python_slim/Dockerfile b/python_slim/Dockerfile
index bba18e9..daba872 100644
--- a/python_slim/Dockerfile
+++ b/python_slim/Dockerfile
@@ -77,6 +77,10 @@ RUN set -eux; \
 	EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \
 	LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; \
 	LDFLAGS="${LDFLAGS:--Wl},--strip-all"; \
+# https://docs.python.org/3.12/howto/perf_profiling.html
+# But don't enable frame-pointers on 32bit x86 due to performance drop.
+# https://github.com/docker-library/python/pull/1000#issuecomment-2597021615
+	test "$gnuArch" != 'i686-linux-gnu' && EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; \
 	make -j "$nproc" \
 		"EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \
 		"LDFLAGS=${LDFLAGS:-}" \

Relevant Maintainers:

@yosifkit yosifkit merged commit 20eb347 into docker-library:master Jan 24, 2025
50 checks passed
@yosifkit yosifkit deleted the python branch January 24, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants