summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/setup.py5
-rw-r--r--numpy/core/setup_common.py15
2 files changed, 8 insertions, 12 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index fe9020111..41f702bd1 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -476,11 +476,8 @@ def configuration(parent_package='',top_path=None):
local_dir = config.local_path
codegen_dir = join(local_dir, 'code_generators')
- if is_released:
- warnings.simplefilter('error', MismatchCAPIWarning)
-
# Check whether we have a mismatch between the set C API VERSION and the
- # actual C API VERSION
+ # actual C API VERSION. Will raise a MismatchCAPIError if so.
check_api_version(C_API_VERSION, codegen_dir)
generate_umath_py = join(codegen_dir, 'generate_umath.py')
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index 81a86728a..27281fd34 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -51,7 +51,7 @@ C_ABI_VERSION = 0x01000009
# 0x00000010 - 1.24.x
C_API_VERSION = 0x00000010
-class MismatchCAPIWarning(Warning):
+class MismatchCAPIError(ValueError):
pass
@@ -87,14 +87,13 @@ def check_api_version(apiversion, codegen_dir):
# To compute the checksum of the current API, use numpy/core/cversions.py
if not curapi_hash == api_hash:
msg = ("API mismatch detected, the C API version "
- "numbers have to be updated. Current C api version is %d, "
- "with checksum %s, but recorded checksum for C API version %d "
- "in core/codegen_dir/cversions.txt is %s. If functions were "
- "added in the C API, you have to update C_API_VERSION in %s."
+ "numbers have to be updated. Current C api version is "
+ f"{apiversion}, with checksum {curapi_hash}, but recorded "
+ f"checksum in core/codegen_dir/cversions.txt is {api_hash}. If "
+ "functions were added in the C API, you have to update "
+ f"C_API_VERSION in {__file__}."
)
- warnings.warn(msg % (apiversion, curapi_hash, apiversion, api_hash,
- __file__),
- MismatchCAPIWarning, stacklevel=2)
+ raise MismatchCAPIError(msg)
FUNC_CALL_ARGS = {}