File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ python3 -m pip install --only-binary=:all: pyarrow || true
3939# PyQt6 doesn't support PyPy3
4040if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
4141 sudo apt-get -qq install libegl1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0
42- # TODO Update condition when pyqt6 supports free-threading
43- if ! [[ " $PYTHON_GIL " == " 0 " ]] ; then python3 -m pip install pyqt6 ; fi
42+ # pyqt6 doesn't yet support free-threading; only install if a wheel is available
43+ python3 -m pip install --only-binary=:all: pyqt6 || true
4444fi
4545
4646# webp
Original file line number Diff line number Diff line change 4242 " 3.15" ,
4343 " 3.14t" ,
4444 " 3.14" ,
45- " 3.13t" ,
4645 " 3.13" ,
4746 " 3.12" ,
4847 " 3.11" ,
5150 include :
5251 - { python-version: "3.12", PYTHONOPTIMIZE: 1, REVERSE: "--reverse" }
5352 - { python-version: "3.11", PYTHONOPTIMIZE: 2 }
54- # Free-threaded
55- - { python-version: "3.15t", disable-gil: true }
56- - { python-version: "3.14t", disable-gil: true }
57- - { python-version: "3.13t", disable-gil: true }
5853 # Intel
5954 - { os: "macos-26-intel", python-version: "3.10" }
6055 exclude :
7873 ".ci/*.sh"
7974 "pyproject.toml"
8075
81- - name : Set PYTHON_GIL
82- if : " ${{ matrix.disable-gil }}"
83- run : |
84- echo "PYTHON_GIL=0" >> $GITHUB_ENV
85-
8676 - name : Build system information
8777 run : python3 .github/workflows/system-info.py
8878
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import io
4+ import sys
5+ import sysconfig
46
57import pytest
68
9+ FREE_THREADED_BUILD = bool (sysconfig .get_config_var ("Py_GIL_DISABLED" ))
10+
11+ gil_enabled_at_start = True
12+ if FREE_THREADED_BUILD :
13+ gil_enabled_at_start = sys ._is_gil_enabled () # type: ignore[attr-defined]
14+
715
816def pytest_report_header (config : pytest .Config ) -> str :
917 try :
@@ -16,6 +24,25 @@ def pytest_report_header(config: pytest.Config) -> str:
1624 return f"pytest_report_header failed: { e } "
1725
1826
27+ def pytest_terminal_summary (terminalreporter : pytest .TerminalReporter ) -> None :
28+ if (
29+ FREE_THREADED_BUILD
30+ and not gil_enabled_at_start
31+ and sys ._is_gil_enabled () # type: ignore[attr-defined]
32+ ):
33+ tr = terminalreporter
34+ tr .ensure_newline ()
35+ tr .section ("GIL re-enabled" , red = True , bold = True )
36+ tr .line ("The GIL was re-enabled at runtime during the tests." )
37+ tr .line ("This can happen with no test failures if the RuntimeWarning" )
38+ tr .line ("raised by Python when this happens is filtered by a test." )
39+ tr .line ("" )
40+ tr .line ("Please ensure all new C modules declare support for running" )
41+ tr .line ("without the GIL. Any new tests that intentionally imports" )
42+ tr .line ("code that re-enables the GIL should do so in a subprocess." )
43+ pytest .exit ("GIL re-enabled during tests" , returncode = 1 )
44+
45+
1946def pytest_configure (config : pytest .Config ) -> None :
2047 config .addinivalue_line (
2148 "markers" ,
You can’t perform that action at this time.
0 commit comments