From 2fa024b45fc41d70b158fff9219df5278d939a1a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 22 May 2025 13:46:11 -0700 Subject: [PATCH] DNM: disable the GIL (experimental) in 3.13+ --- 3.13/alpine3.21/Dockerfile | 2 ++ 3.13/alpine3.22/Dockerfile | 2 ++ 3.13/bookworm/Dockerfile | 2 ++ 3.13/bullseye/Dockerfile | 2 ++ 3.13/slim-bookworm/Dockerfile | 2 ++ 3.13/slim-bullseye/Dockerfile | 2 ++ 3.14-rc/alpine3.21/Dockerfile | 2 ++ 3.14-rc/alpine3.22/Dockerfile | 2 ++ 3.14-rc/bookworm/Dockerfile | 2 ++ 3.14-rc/bullseye/Dockerfile | 2 ++ 3.14-rc/slim-bookworm/Dockerfile | 2 ++ 3.14-rc/slim-bullseye/Dockerfile | 2 ++ Dockerfile-linux.template | 4 ++++ 13 files changed, 28 insertions(+) diff --git a/3.13/alpine3.21/Dockerfile b/3.13/alpine3.21/Dockerfile index 51bb4f4dd..f376a396f 100644 --- a/3.13/alpine3.21/Dockerfile +++ b/3.13/alpine3.21/Dockerfile @@ -73,6 +73,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() diff --git a/3.13/alpine3.22/Dockerfile b/3.13/alpine3.22/Dockerfile index e09ba23c6..a2174c5e9 100644 --- a/3.13/alpine3.22/Dockerfile +++ b/3.13/alpine3.22/Dockerfile @@ -73,6 +73,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() diff --git a/3.13/bookworm/Dockerfile b/3.13/bookworm/Dockerfile index 0e7a877df..ca2c16e1d 100644 --- a/3.13/bookworm/Dockerfile +++ b/3.13/bookworm/Dockerfile @@ -47,6 +47,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.13/bullseye/Dockerfile b/3.13/bullseye/Dockerfile index 727708bed..d253987d1 100644 --- a/3.13/bullseye/Dockerfile +++ b/3.13/bullseye/Dockerfile @@ -47,6 +47,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.13/slim-bookworm/Dockerfile b/3.13/slim-bookworm/Dockerfile index 7b83eeb0d..c4c8f7a84 100644 --- a/3.13/slim-bookworm/Dockerfile +++ b/3.13/slim-bookworm/Dockerfile @@ -72,6 +72,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.13/slim-bullseye/Dockerfile b/3.13/slim-bullseye/Dockerfile index 6525ba94b..41d7508bd 100644 --- a/3.13/slim-bullseye/Dockerfile +++ b/3.13/slim-bullseye/Dockerfile @@ -72,6 +72,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.14-rc/alpine3.21/Dockerfile b/3.14-rc/alpine3.21/Dockerfile index 12ae69e73..75286a5c2 100644 --- a/3.14-rc/alpine3.21/Dockerfile +++ b/3.14-rc/alpine3.21/Dockerfile @@ -66,6 +66,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() diff --git a/3.14-rc/alpine3.22/Dockerfile b/3.14-rc/alpine3.22/Dockerfile index 87d223fc3..96836c35f 100644 --- a/3.14-rc/alpine3.22/Dockerfile +++ b/3.14-rc/alpine3.22/Dockerfile @@ -66,6 +66,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() diff --git a/3.14-rc/bookworm/Dockerfile b/3.14-rc/bookworm/Dockerfile index effe40bb2..3295725ae 100644 --- a/3.14-rc/bookworm/Dockerfile +++ b/3.14-rc/bookworm/Dockerfile @@ -40,6 +40,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.14-rc/bullseye/Dockerfile b/3.14-rc/bullseye/Dockerfile index f6246d76f..d427e13fc 100644 --- a/3.14-rc/bullseye/Dockerfile +++ b/3.14-rc/bullseye/Dockerfile @@ -40,6 +40,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.14-rc/slim-bookworm/Dockerfile b/3.14-rc/slim-bookworm/Dockerfile index 22d716de4..374dfd225 100644 --- a/3.14-rc/slim-bookworm/Dockerfile +++ b/3.14-rc/slim-bookworm/Dockerfile @@ -65,6 +65,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/3.14-rc/slim-bullseye/Dockerfile b/3.14-rc/slim-bullseye/Dockerfile index d8cff31e8..f9ad413e5 100644 --- a/3.14-rc/slim-bullseye/Dockerfile +++ b/3.14-rc/slim-bullseye/Dockerfile @@ -65,6 +65,8 @@ RUN set -eux; \ --enable-shared \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ --with-ensurepip \ +# https://github.com/docker-library/python/issues/947 + --disable-gil \ ; \ nproc="$(nproc)"; \ EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; \ diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index 8b3b8c824..07db42c9a 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -186,6 +186,10 @@ RUN set -eux; \ $(test "$gnuArch" != 'riscv64-linux-musl' && echo '--with-lto') \ {{ ) end -}} --with-ensurepip \ +{{ if IN(rcVersion; "3.9", "3.10", "3.11", "3.12") then "" else ( -}} +# https://github.com/docker-library/python/issues/947 + --disable-gil \ +{{ ) end -}} ; \ nproc="$(nproc)"; \ {{ if is_alpine then ( -}}