File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -311,3 +311,6 @@ jobs:
311
311
run : |
312
312
pip install git+https://github.com/cython/cython
313
313
- uses : ./.github/meson_actions
314
+ env :
315
+ # needed until f2py grows a config flag for GIL-disabled support
316
+ PYTHON_GIL : 0
Original file line number Diff line number Diff line change @@ -34,6 +34,20 @@ if [[ $FREE_THREADED_BUILD == "True" ]]; then
34
34
# with a released version of cython
35
35
python -m pip uninstall -y cython
36
36
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
37
+
38
+ # Manually check that importing NumPy does not re-enable the GIL.
39
+ # Afterwards, force the GIL to always be disabled so it does not get
40
+ # re-enabled during the tests.
41
+ #
42
+ # TODO: delete when f2py grows the ability to define extensions that declare
43
+ # they can run without the gil or when we can work around the fact the f2py
44
+ # tests import modules that don't declare gil-disabled support.
45
+ if [[ $( python -c " import numpy" 2>&1 ) == " *The global interpreter lock (GIL) has been enabled*" ]]; then
46
+ echo " Error: Importing NumPy re-enables the GIL in the free-threaded build"
47
+ exit 1
48
+ fi
49
+
50
+ export PYTHON_GIL=0
37
51
fi
38
52
39
53
# Run full tests with -n=auto. This makes pytest-xdist distribute tests across
You can’t perform that action at this time.
0 commit comments