|
51 | 51 | # 0x00000010 - 1.24.x
|
52 | 52 | C_API_VERSION = 0x00000010
|
53 | 53 |
|
54 |
| -class MismatchCAPIWarning(Warning): |
| 54 | +class MismatchCAPIError(ValueError): |
55 | 55 | pass
|
56 | 56 |
|
57 | 57 |
|
@@ -87,14 +87,13 @@ def check_api_version(apiversion, codegen_dir):
|
87 | 87 | # To compute the checksum of the current API, use numpy/core/cversions.py
|
88 | 88 | if not curapi_hash == api_hash:
|
89 | 89 | msg = ("API mismatch detected, the C API version "
|
90 |
| - "numbers have to be updated. Current C api version is %d, " |
91 |
| - "with checksum %s, but recorded checksum for C API version %d " |
92 |
| - "in core/codegen_dir/cversions.txt is %s. If functions were " |
93 |
| - "added in the C API, you have to update C_API_VERSION in %s." |
| 90 | + "numbers have to be updated. Current C api version is " |
| 91 | + f"{apiversion}, with checksum {curapi_hash}, but recorded " |
| 92 | + f"checksum in core/codegen_dir/cversions.txt is {api_hash}. If " |
| 93 | + "functions were added in the C API, you have to update " |
| 94 | + f"C_API_VERSION in {__file__}." |
94 | 95 | )
|
95 |
| - warnings.warn(msg % (apiversion, curapi_hash, apiversion, api_hash, |
96 |
| - __file__), |
97 |
| - MismatchCAPIWarning, stacklevel=2) |
| 96 | + raise MismatchCAPIError(msg) |
98 | 97 |
|
99 | 98 |
|
100 | 99 | FUNC_CALL_ARGS = {}
|
|
0 commit comments