From 8c537d647f1cbbfbe8926808e61594e59760a4c0 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.20/Dockerfile | 2 ++ 3.13/alpine3.21/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.20/Dockerfile | 2 ++ 3.14-rc/alpine3.21/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.20/Dockerfile b/3.13/alpine3.20/Dockerfile index c3b9eb310..67429a79d 100644 --- a/3.13/alpine3.20/Dockerfile +++ b/3.13/alpine3.20/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.21/Dockerfile b/3.13/alpine3.21/Dockerfile index c289fda11..07328c23c 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/bookworm/Dockerfile b/3.13/bookworm/Dockerfile index 4a3f8a2b1..3a9fb225d 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 1267fa3e6..19e3dce7e 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 15a408ab7..e7ee375d8 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 09ba3b8c2..c09d46686 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.20/Dockerfile b/3.14-rc/alpine3.20/Dockerfile index 70e5d43be..9ea2a93b8 100644 --- a/3.14-rc/alpine3.20/Dockerfile +++ b/3.14-rc/alpine3.20/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.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/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 ( -}}