added 13 commits
January 3, 2023 15:45This test only checked for a plain match when comparing outputs. However, in some cases a reconstruction check can be necessary, as in `test_linalg_svd`.
The modified regex matches the existing message produced by NumPy < 1.24, and the new improved message in 1.24.
This always produced invalid results (though they were consistent between Numba and NumPy) but now this fails in NumPy 1.24 with an exception: ``` TypeError: The `dtype` and `signature` arguments to ufuncs only select the general DType and not details such as the byte order or time unit. You can avoid this error by using the scalar types `np.float64` or the dtype string notation. ``` Note that the exception message is misleading, and using the dtype string notation does not provide a workaround.
If an unexpected ufunc method was encountered, `init_ufunc_dispatch()` would return an error code indicating failure without setting an exception, leading to errors like ``` SystemError: initialization of _internal failed without raising an exception ``` as reported in Issue numba#8615. This commit fixes the issue by setting an appropriate exception in this case.
NumPy 1.24 adds a new method, `resolve_dtypes()`, and a private method `_resolve_dtypes_and_context()`. We handle these by just ignoring them (ignoring all private methods in general) in order to provide the same level of functionality in Numba as for NumPy 1.23. There is further room to build new functionality on top of this: - Providing an implementation of `resolve_dtypes()` for `DUFunc` objects. - Using the `resolve_dtypes()` method in place of logic in Numba that implements a similar dtype resolution process.
This results in the following output from `print_azure_matrix()`: ``` NumPy | Python | Count ----------------------- 1.21 | 3.8 | 4 1.22 | 3.8 | 4 1.22 | 3.9 | 1 1.23 | 3.8 | 2 1.23 | 3.9 | 2 1.23 | 3.10 | 1 1.24 | 3.10 | 3 1.24 | 3.8 | 1 1.24 | 3.9 | 1 ``` There are 19 slices, so the aim was to have five slices for each NumPy version (1.21, 1.22, 1.23, 1.24) except for 1.21 which has 4 slices.
Merged
7 tasks
Open
Open
Merged
12 tasks
Merged
1 task
sklam
changed the title
NumPy 1.24 (PR for review)
NumPy 1.24
Closed
esc
mentioned this pull request
Closed
Closed
Merged
Closed
2 tasks
Merged
Closed
shaneahmed added a commit to TissueImageAnalytics/tiatoolbox that referenced this pull request
May 3, 2023- np.int, np.bool, np.float is depreciated in v1.20 in favour of np.int_, np.bool_, np.float_ Waiting on some dependencies to update: - numba not yet compatible with numpy 1.24 > from numba.np.ufunc import _internal E SystemError: initialization of _internal failed without raising an exception - numba/numba#8464 - numba/numba#8691 - numba/numba#8841 - https://github.com/numba/numba/milestone/63 - [x] Waiting for next numba release with numpy 1.24 support. --------- Co-authored-by: John Pocock <John-P@users.noreply.github.com>