summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/bscript7
-rw-r--r--numpy/core/setup.py9
2 files changed, 16 insertions, 0 deletions
diff --git a/numpy/core/bscript b/numpy/core/bscript
index 3d9b84018..3a2bb2340 100644
--- a/numpy/core/bscript
+++ b/numpy/core/bscript
@@ -31,6 +31,7 @@ from setup_common \
MANDATORY_FUNCS, C_ABI_VERSION, C_API_VERSION
ENABLE_SEPARATE_COMPILATION = (os.environ.get('NPY_SEPARATE_COMPILATION', "1") != "0")
+NPY_RELAXED_STRIDES_CHECKING = (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "0") != "0")
NUMPYCONFIG_SYM = []
@@ -39,6 +40,12 @@ if ENABLE_SEPARATE_COMPILATION:
NUMPYCONFIG_SYM.append(('DEFINE_NPY_ENABLE_SEPARATE_COMPILATION', '#define NPY_ENABLE_SEPARATE_COMPILATION 1'))
else:
NUMPYCONFIG_SYM.append(('DEFINE_NPY_ENABLE_SEPARATE_COMPILATION', ''))
+
+if NPY_RELAXED_STRIDES_CHECKING:
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_RELAXED_STRIDES_CHECKING', '#define NPY_RELAXED_STRIDES_CHECKING 1'))
+else:
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_RELAXED_STRIDES_CHECKING', ''))
+
NUMPYCONFIG_SYM.append(('VISIBILITY_HIDDEN', '__attribute__((visibility("hidden")))'))
NUMPYCONFIG_SYM.append(('NPY_ABI_VERSION', '0x%.8X' % C_ABI_VERSION))
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index 37f649e6b..c65012126 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -15,6 +15,9 @@ from setup_common import *
# Set to True to enable multiple file compilations (experimental)
ENABLE_SEPARATE_COMPILATION = (os.environ.get('NPY_SEPARATE_COMPILATION', "1") != "0")
+# Set to True to enable relaxed strides checking. This (mostly) means
+# that `strides[dim]` is ignored if `shape[dim] == 1` when setting flags.
+NPY_RELAXED_STRIDES_CHECKING = (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "0") != "0")
# XXX: ugly, we use a class to avoid calling twice some expensive functions in
# config.h/numpyconfig.h. I don't see a better way because distutils force
@@ -435,6 +438,9 @@ def configuration(parent_package='',top_path=None):
if ENABLE_SEPARATE_COMPILATION:
moredefs.append(('ENABLE_SEPARATE_COMPILATION', 1))
+ if NPY_RELAXED_STRIDES_CHECKING:
+ moredefs.append(('NPY_RELAXED_STRIDES_CHECKING', 1))
+
# Get long double representation
if sys.platform != 'darwin':
rep = check_long_double_representation(config_cmd)
@@ -532,6 +538,9 @@ def configuration(parent_package='',top_path=None):
if ENABLE_SEPARATE_COMPILATION:
moredefs.append(('NPY_ENABLE_SEPARATE_COMPILATION', 1))
+ if NPY_RELAXED_STRIDES_CHECKING:
+ moredefs.append(('NPY_RELAXED_STRIDES_CHECKING', 1))
+
# Check wether we can use inttypes (C99) formats
if config_cmd.check_decl('PRIdPTR', headers = ['inttypes.h']):
moredefs.append(('NPY_USE_C99_FORMATS', 1))