8000 MNT Configures boundscheck=True for one of the CI instances (#21779) · thomasjpfan/scikit-learn@a611fed · GitHub
[go: up one dir, main page]

Skip to content

Commit a611fed

Browse files
authored
MNT Configures boundscheck=True for one of the CI instances (scikit-learn#21779)
1 parent f96ce58 commit a611fed

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ jobs:
200200
SCIPY_VERSION: 'min'
201201
MATPLOTLIB_VERSION: 'min'
202202
THREADPOOLCTL_VERSION: '2.2.0'
203+
SKLEARN_ENABLE_DEBUG_CYTHON_DIRECTIVES: '1'
203204
# Linux environment to test the latest available dependencies and MKL.
204205
# It runs tests requiring lightgbm, pandas and PyAMG.
205206
pylatest_pip_openblas_pandas:

doc/computing/parallelism.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,9 @@ These environment variables should be set before importing scikit-learn.
214214
When this environment variable is set to a non zero value, the tests
215215
that need network access are skipped. When this environment variable is
216216
not set then network tests are skipped.
217+
218+
:SKLEARN_ENABLE_DEBUG_CYTHON_DIRECTIVES:
219+
220+
When this environment variable is set to a non zero value, the `Cython`
221+
derivative, `boundscheck` is set to `True`. This is useful for finding
222+
segfaults.

sklearn/_build_utils/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ def cythonize_extensions(top_path, config):
7070
# CPU particularly in CI (cf loky#114)
7171
n_jobs = joblib.cpu_count()
7272

73+
# Additional checks for Cython
74+
cython_enable_debug_directives = (
75+
os.environ.get("SKLEARN_ENABLE_DEBUG_CYTHON_DIRECTIVES", "0") != "0"
76+
)
77+
7378
config.ext_modules = cythonize(
7479
config.ext_modules,
7580
nthreads=n_jobs,
@@ -78,7 +83,7 @@ def cythonize_extensions(top_path, config):
7883
},
7984
compiler_directives={
8085
"language_level": 3,
81-
"boundscheck": False,
86+
"boundscheck": cython_enable_debug_directives,
8287
"wraparound": False,
8388
"initializedcheck": False,
8489
"nonecheck": False,

0 commit comments

Comments
 (0)
0