summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-12-07 16:23:25 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2021-01-07 17:59:23 -0600
commitaa8984364ebf19cbcce5d64e354fd02d9dc531cd (patch)
treeb07c53cebb5079b79e1b2e12f2e31253a0bd28c9
parent73fe877ff967f279d470b81ad447b9f3056c1335 (diff)
downloadnumpy-aa8984364ebf19cbcce5d64e354fd02d9dc531cd.tar.gz
MAINT: Move modref definition into setup.py
It seems the only reason this did not cause problems before was that the test checking for C warnings only ran on a run where these were always 0 and thus undefined (and so were not redefined later). The `#ifndef` would have to happen at a later time apparently, so just avoid it.
-rw-r--r--numpy/core/include/numpy/npy_common.h10
-rw-r--r--numpy/core/setup.py6
2 files changed, 6 insertions, 10 deletions
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
index c8495db8e..d5f329b66 100644
--- a/numpy/core/include/numpy/npy_common.h
+++ b/numpy/core/include/numpy/npy_common.h
@@ -10,16 +10,6 @@
#include <npy_config.h>
#endif
-// compile time environment variables
-#ifndef NPY_RELAXED_STRIDES_CHECKING
- #define NPY_RELAXED_STRIDES_CHECKING 0
-#endif
-#ifndef NPY_RELAXED_STRIDES_DEBUG
- #define NPY_RELAXED_STRIDES_DEBUG 0
-#endif
-#ifndef NPY_USE_NEW_CASTINGIMPL
- #define NPY_USE_NEW_CASTINGIMPL 0
-#endif
/*
* using static inline modifiers when defining npy_math functions
* allows the compiler to make optimizations when possible
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index dfb26c9c1..b73e55eb6 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -468,14 +468,20 @@ def configuration(parent_package='',top_path=None):
# Use relaxed stride checking
if NPY_RELAXED_STRIDES_CHECKING:
moredefs.append(('NPY_RELAXED_STRIDES_CHECKING', 1))
+ else:
+ moredefs.append(('NPY_RELAXED_STRIDES_CHECKING', 0))
# Use bogus stride debug aid when relaxed strides are enabled
if NPY_RELAXED_STRIDES_DEBUG:
moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 1))
+ else:
+ moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 0))
# Use the new experimental casting implementation in NumPy 1.20:
if NPY_USE_NEW_CASTINGIMPL:
moredefs.append(('NPY_USE_NEW_CASTINGIMPL', 1))
+ else:
+ moredefs.append(('NPY_USE_NEW_CASTINGIMPL', 0))
# Get long double representation
rep = check_long_double_representation(config_cmd)