From 88c01914126f25884ada59562361c36c2d30c19f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 08:21:02 -0700 Subject: [PATCH 01/12] =?UTF-8?q?Fix=20"=F0=9F=90=8D=203=20=E2=80=A2=20win?= =?UTF-8?q?dows-latest=20=E2=80=A2=20mingw64"=20job=20(apparently=20msys2/?= =?UTF-8?q?setup-msys2@v2=20cannot=20be=20run=20twice=20anymore):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/pybind/pybind11/actions/runs/17394902023/job/49417376616?pr=5796 ``` Run msys2/setup-msys2@v2 with: msystem: mingw64 install: mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy mingw-w64-x86_64-eigen3 path-type: minimal update: false pacboy: false release: true location: RUNNER_TEMP platform-check-severity: fatal cache: true env: PYTHONDEVMODE: 1 PIP_BREAK_SYSTEM_PACKAGES: 1 PIP_ONLY_BINARY: numpy FORCE_COLOR: 3 PYTEST_TIMEOUT: 300 VERBOSE: 1 CMAKE_COLOR_DIAGNOSTICS: 1 MSYSTEM: MINGW64 Error: Trying to install MSYS2 to D:\a\_temp\msys64 but that already exists, cannot continue. ``` --- .github/workflows/ci.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0985b5cf49..6e990c6283 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1019,8 +1019,15 @@ jobs: fail-fast: false matrix: include: - - { sys: mingw64, env: x86_64 } - - { sys: mingw32, env: i686 } + - sys: mingw32 + env: i686 + install_mingw64_only: "" + - sys: mingw64 + env: x86_64 + install_mingw64_only: | + mingw-w64-x86_64-python-numpy + mingw-w64-x86_64-python-scipy + mingw-w64-x86_64-eigen3 steps: - uses: msys2/setup-msys2@v2 with: @@ -1034,15 +1041,7 @@ jobs: mingw-w64-${{matrix.env}}-python-pytest mingw-w64-${{matrix.env}}-boost mingw-w64-${{matrix.env}}-catch - - - uses: msys2/setup-msys2@v2 - if: matrix.sys == 'mingw64' - with: - msystem: ${{matrix.sys}} - install: >- - mingw-w64-${{matrix.env}}-python-numpy - mingw-w64-${{matrix.env}}-python-scipy - mingw-w64-${{matrix.env}}-eigen3 + ${{ matrix.install_mingw64_only }} - uses: actions/checkout@v4 From 61d7577cd88b08a29e3675bf08f7024db83eba9f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 13:41:35 -0700 Subject: [PATCH 02/12] Add `pytest.xfail("[TEST-GIL-SCOPED] macOS free-threading...)` --- tests/env.py | 4 ++++ tests/test_cpp_conduit.py | 2 +- tests/test_gil_scoped.py | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/env.py b/tests/env.py index 95cc1ac611..93e7815e38 100644 --- a/tests/env.py +++ b/tests/env.py @@ -18,7 +18,11 @@ sys.modules["__graalpython__"].get_graalvm_version() if GRAALPY else "0.0.0" ) GRAALPY_VERSION = tuple(int(t) for t in _graalpy_version.split("-")[0].split(".")[:3]) + +# Compile-time config (what the binary was built for) PY_GIL_DISABLED = bool(sysconfig.get_config_var("Py_GIL_DISABLED")) +# Runtime state (what's actually happening now) +SYS_IS_GIL_ENABLED = getattr(sys, "_is_gil_enabled", lambda: True)() def deprecated_call(): diff --git a/tests/test_cpp_conduit.py b/tests/test_cpp_conduit.py index 5650a65367..96dc010f21 100644 --- a/tests/test_cpp_conduit.py +++ b/tests/test_cpp_conduit.py @@ -12,7 +12,7 @@ def import_warns_freethreaded(name): - if name not in sys.modules and not getattr(sys, "_is_gil_enabled", lambda: True)(): + if name not in sys.modules and not env.SYS_IS_GIL_ENABLED: with pytest.warns( RuntimeWarning, match=f"has been enabled to load module '{name}'" ): diff --git a/tests/test_gil_scoped.py b/tests/test_gil_scoped.py index 04f7b09c71..7610096143 100644 --- a/tests/test_gil_scoped.py +++ b/tests/test_gil_scoped.py @@ -199,8 +199,10 @@ def _run_in_process(target, *args, **kwargs): if process.exitcode is None: assert t_delta > 0.9 * timeout msg = "DEADLOCK, most likely, exactly what this test is meant to detect." - if env.PYPY and env.WIN: - pytest.skip(msg) + if env.WIN and env.PYPY: + pytest.xfail("[TEST-GIL-SCOPED] Windows PyPy: " + msg) + elif env.MACOS and not env.SYS_IS_GIL_ENABLED: + pytest.xfail("[TEST-GIL-SCOPED] macOS free-threading: " + msg) raise RuntimeError(msg) return process.exitcode finally: From 25b4c334acb958806f718e0bd1a1b9902301752c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 14:19:37 -0700 Subject: [PATCH 03/12] Change env.SYS_IS_GIL_ENABLED constant to env.sys_is_gil_enabled function --- tests/env.py | 2 +- tests/test_cpp_conduit.py | 2 +- tests/test_gil_scoped.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/env.py b/tests/env.py index 93e7815e38..ae239a741b 100644 --- a/tests/env.py +++ b/tests/env.py @@ -22,7 +22,7 @@ # Compile-time config (what the binary was built for) PY_GIL_DISABLED = bool(sysconfig.get_config_var("Py_GIL_DISABLED")) # Runtime state (what's actually happening now) -SYS_IS_GIL_ENABLED = getattr(sys, "_is_gil_enabled", lambda: True)() +sys_is_gil_enabled = getattr(sys, "_is_gil_enabled", lambda: True) def deprecated_call(): diff --git a/tests/test_cpp_conduit.py b/tests/test_cpp_conduit.py index 96dc010f21..652b9b9c5e 100644 --- a/tests/test_cpp_conduit.py +++ b/tests/test_cpp_conduit.py @@ -12,7 +12,7 @@ def import_warns_freethreaded(name): - if name not in sys.modules and not env.SYS_IS_GIL_ENABLED: + if name not in sys.modules and not env.sys_is_gil_enabled(): with pytest.warns( RuntimeWarning, match=f"has been enabled to load module '{name}'" ): diff --git a/tests/test_gil_scoped.py b/tests/test_gil_scoped.py index 7610096143..98a4226001 100644 --- a/tests/test_gil_scoped.py +++ b/tests/test_gil_scoped.py @@ -201,7 +201,7 @@ def _run_in_process(target, *args, **kwargs): msg = "DEADLOCK, most likely, exactly what this test is meant to detect." if env.WIN and env.PYPY: pytest.xfail("[TEST-GIL-SCOPED] Windows PyPy: " + msg) - elif env.MACOS and not env.SYS_IS_GIL_ENABLED: + elif env.MACOS and not env.sys_is_gil_enabled(): pytest.xfail("[TEST-GIL-SCOPED] macOS free-threading: " + msg) raise RuntimeError(msg) return process.exitcode From bb8a7940aa0b418ee85061bb1eca37488932c597 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 16:28:27 -0700 Subject: [PATCH 04/12] =?UTF-8?q?Change=20install=5Fmingw64=5Fonly=20?= =?UTF-8?q?=E2=86=92=20extra=5Finstall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e990c6283..1b3c8edd89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1021,10 +1021,10 @@ jobs: include: - sys: mingw32 env: i686 - install_mingw64_only: "" + extra_install: "" - sys: mingw64 env: x86_64 - install_mingw64_only: | + extra_install: | mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-scipy mingw-w64-x86_64-eigen3 @@ -1041,7 +1041,7 @@ jobs: mingw-w64-${{matrix.env}}-python-pytest mingw-w64-${{matrix.env}}-boost mingw-w64-${{matrix.env}}-catch - ${{ matrix.install_mingw64_only }} + ${{ matrix.extra_install }} - uses: actions/checkout@v4 From 13c1c14c7cf6f0285e068bf38c1cd4c1c7160a78 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 21:16:33 -0700 Subject: [PATCH 05/12] Also xfail if macOS and PY_GIL_DISABLED, show SOABI --- tests/test_gil_scoped.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_gil_scoped.py b/tests/test_gil_scoped.py index 98a4226001..84a7a999ab 100644 --- a/tests/test_gil_scoped.py +++ b/tests/test_gil_scoped.py @@ -199,10 +199,14 @@ def _run_in_process(target, *args, **kwargs): if process.exitcode is None: assert t_delta > 0.9 * timeout msg = "DEADLOCK, most likely, exactly what this test is meant to detect." + soabi = sysconfig.get_config_var("SOABI") if env.WIN and env.PYPY: - pytest.xfail("[TEST-GIL-SCOPED] Windows PyPy: " + msg) - elif env.MACOS and not env.sys_is_gil_enabled(): - pytest.xfail("[TEST-GIL-SCOPED] macOS free-threading: " + msg) + pytest.xfail(f"[TEST-GIL-SCOPED] {soabi} PyPy: " + msg) + if env.MACOS: + if not env.sys_is_gil_enabled(): + pytest.xfail(f"[TEST-GIL-SCOPED] {soabi} with GIL disabled: " + msg) + if env.PY_GIL_DISABLED: + pytest.xfail(f"[TEST-GIL-SCOPED] {soabi}: " + msg) raise RuntimeError(msg) return process.exitcode finally: From bd3900ee794a01bb1ef91a9355ce72be619a7196 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 22:06:35 -0700 Subject: [PATCH 06/12] build-ios: brew upgrade|install cmake --- .github/workflows/tests-cibw.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 0abddd0be0..94a42d00bf 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -42,7 +42,9 @@ jobs: submodules: true fetch-depth: 0 - - run: brew upgrade cmake + - run: | + brew update + brew upgrade --formula cmake || brew install --formula cmake - uses: pypa/cibuildwheel@v3.1 env: From bd757612f417e8b9b5c86bf02721c8d1109f38a4 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 23:18:13 -0700 Subject: [PATCH 07/12] Revert "build-ios: brew upgrade|install cmake" This reverts commit bd3900ee794a01bb1ef91a9355ce72be619a7196. See also: https://github.com/pybind/pybind11/pull/5822#issuecomment-3247827317 --- .github/workflows/tests-cibw.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 94a42d00bf..0abddd0be0 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -42,9 +42,7 @@ jobs: submodules: true fetch-depth: 0 - - run: | - brew update - brew upgrade --formula cmake || brew install --formula cmake + - run: brew upgrade cmake - uses: pypa/cibuildwheel@v3.1 env: From 0f5a29d85de1e19aa4bfd6258b69d6c0f49f3b67 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 2 Sep 2025 23:36:13 -0700 Subject: [PATCH 08/12] Disable build-ios job in tests-cibw.yml --- .github/workflows/tests-cibw.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 0abddd0be0..0a229c5b04 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -30,6 +30,7 @@ jobs: only: cp312-pyodide_wasm32 build-ios: + if: github.event_name == 'THIS NEEDS FIXING' # trick to disable the job name: iOS wheel ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }} strategy: @@ -42,7 +43,7 @@ jobs: submodules: true fetch-depth: 0 - - run: brew upgrade cmake + - run: brew upgrade cmake # this was the FAILING step - uses: pypa/cibuildwheel@v3.1 env: From e70ac7f782dd90558bc1e214a9af03e70404bbbe Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 3 Sep 2025 00:45:36 -0700 Subject: [PATCH 09/12] Remove macos_brew_install_llvm job because it started failing, to reduce our maintenance overhead: Failures tracked here: https://github.com/pybind/pybind11/pull/5822#issuecomment-3247998220 --- .github/workflows/ci.yml | 88 ---------------------------------------- 1 file changed, 88 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b3c8edd89..b0f1aee9da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1188,91 +1188,3 @@ jobs: - name: Clean directory run: git clean -fdx - - macos_brew_install_llvm: - if: github.event.pull_request.draft == false - name: "macos-13 • brew install llvm" - runs-on: macos-13 - - env: - # https://apple.stackexchange.com/questions/227026/how-to-install-recent-clang-with-homebrew - LDFLAGS: '-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib' - - steps: - - name: Update PATH - run: echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH - - - name: Show env - run: env - - - name: Checkout - uses: actions/checkout@v4 - - - name: Show Clang++ version before brew install llvm - run: clang++ --version - - - name: brew install llvm - run: brew install llvm - - - name: Show Clang++ version after brew install llvm - run: clang++ --version - - - name: Update CMake - uses: jwlawson/actions-setup-cmake@v2.0 - - - name: Run pip installs - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r tests/requirements.txt - python3 -m pip install numpy - python3 -m pip install scipy - - - name: Show CMake version - run: cmake --version - - - name: CMake Configure - run: > - cmake -S . -B . - -DPYBIND11_WERROR=ON - -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - -DCMAKE_CXX_COMPILER=clang++ - -DCMAKE_CXX_STANDARD=17 - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - - - name: Build - run: cmake --build . -j 2 - - - name: Python tests - run: cmake --build . --target pytest -j 2 - - - name: C++ tests - run: cmake --build . --target cpptest -j 2 - - - name: Interface test - run: cmake --build . --target test_cmake_build -j 2 - - - name: Visibility test - run: cmake --build . --target test_cross_module_rtti -j 2 - - - name: CMake Configure - Exercise cmake -DPYBIND11_TEST_OVERRIDE - run: > - cmake -S . -B build_partial - -DPYBIND11_WERROR=ON - -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF - -DDOWNLOAD_CATCH=ON - -DDOWNLOAD_EIGEN=ON - -DCMAKE_CXX_COMPILER=clang++ - -DCMAKE_CXX_STANDARD=17 - -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") - "-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp" - - - name: Build - Exercise cmake -DPYBIND11_TEST_OVERRIDE - run: cmake --build build_partial -j 2 - - - name: Python tests - Exercise cmake -DPYBIND11_TEST_OVERRIDE - run: cmake --build build_partial --target pytest -j 2 - - - name: Clean directory - run: git clean -fdx From 4de21d8a3fb5509725303e31c19b081b00f6145d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 3 Sep 2025 09:54:41 -0400 Subject: [PATCH 10/12] Fix iOS build step for cmake installation Replaced brew upgrade with brew install for cmake. --- .github/workflows/tests-cibw.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 0a229c5b04..ededeb1fb1 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -30,7 +30,6 @@ jobs: only: cp312-pyodide_wasm32 build-ios: - if: github.event_name == 'THIS NEEDS FIXING' # trick to disable the job name: iOS wheel ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }} strategy: @@ -43,7 +42,7 @@ jobs: submodules: true fetch-depth: 0 - - run: brew upgrade cmake # this was the FAILING step + - run: brew install cmake - uses: pypa/cibuildwheel@v3.1 env: From 38e9fa73aad71876db350ccd811e04bea0af2a45 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 3 Sep 2025 09:59:41 -0400 Subject: [PATCH 11/12] Update cmake installation steps in CI workflow Uninstall cmake before installing the latest version due to GitHub's local tap changes. --- .github/workflows/tests-cibw.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index ededeb1fb1..027d95dbf6 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -42,7 +42,8 @@ jobs: submodules: true fetch-depth: 0 - - run: brew install cmake + # We have ot uninstall first because GH is now using a local tap to build cmake<4, iOS needs cmake>=4 + - run: brew uninstall cmake && brew install cmake - uses: pypa/cibuildwheel@v3.1 env: From 26496bbe3be7d241e30a23026d241ec3ae3321f5 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 3 Sep 2025 10:00:14 -0400 Subject: [PATCH 12/12] Update .github/workflows/tests-cibw.yml --- .github/workflows/tests-cibw.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-cibw.yml b/.github/workflows/tests-cibw.yml index 027d95dbf6..71d07a764b 100644 --- a/.github/workflows/tests-cibw.yml +++ b/.github/workflows/tests-cibw.yml @@ -42,7 +42,7 @@ jobs: submodules: true fetch-depth: 0 - # We have ot uninstall first because GH is now using a local tap to build cmake<4, iOS needs cmake>=4 + # We have to uninstall first because GH is now using a local tap to build cmake<4, iOS needs cmake>=4 - run: brew uninstall cmake && brew install cmake - uses: pypa/cibuildwheel@v3.1