2
PYTHON setup.py build_ext --inplace
3
PYTHON -c "import default; default.test()"
4
PYTHON -c "import compatible; compatible.test()"
5
PYTHON -c "import incompatible; incompatible.test()"
6
PYTHON -c "import default_single; default_single.test()"
7
PYTHON -c "import compatible_single; compatible_single.test()"
8
PYTHON -c "import incompatible_single; incompatible_single.test()"
10
######## setup.py ########
12
from Cython.Build import cythonize
13
from setuptools import setup, Extension
16
Extension('default', ['default.py']),
17
Extension('compatible', ['compatible.py']),
18
Extension('incompatible', ['incompatible.py']),
19
Extension('default_single',
20
['default_single.py'],
21
define_macros=[('CYTHON_PEP489_MULTI_PHASE_INIT', '0')]),
22
Extension('compatible_single',
23
['compatible_single.py'],
24
define_macros=[('CYTHON_PEP489_MULTI_PHASE_INIT', '0')]),
25
Extension('incompatible_single',
26
['incompatible_single.py'],
27
define_macros=[('CYTHON_PEP489_MULTI_PHASE_INIT', '0')]),
30
setup(ext_modules=cythonize(ext_modules))
32
######## default.py ########
37
if not sysconfig.get_config_var("Py_GIL_DISABLED"):
39
assert sys._is_gil_enabled()
41
######## compatible.py ########
43
# cython: freethreading_compatible=True
48
if not sysconfig.get_config_var("Py_GIL_DISABLED"):
50
assert not sys._is_gil_enabled()
52
######## incompatible.py ########
54
# cython: freethreading_compatible=False
59
if not sysconfig.get_config_var("Py_GIL_DISABLED"):
61
assert sys._is_gil_enabled()
63
######## default_single.py ########
68
if not sysconfig.get_config_var("Py_GIL_DISABLED"):
70
assert sys._is_gil_enabled()
72
######## compatible_single.py ########
74
# cython: freethreading_compatible=True
79
if not sysconfig.get_config_var("Py_GIL_DISABLED"):
81
assert not sys._is_gil_enabled()
83
######## incompatible_single.py ########
85
# cython: freethreading_compatible=False
90
if not sysconfig.get_config_var("Py_GIL_DISABLED"):
92
assert sys._is_gil_enabled()