diff --git a/numba/np/arraymath.py b/numba/np/arraymath.py index f13ecf456dc..67820c3e728 100644 --- a/numba/np/arraymath.py +++ b/numba/np/arraymath.py @@ -1830,7 +1830,7 @@ def np_argpartition_impl_inner(a, kth_array): # allocate and fill empty array rather than copy a and mutate in place # as the latter approach fails to preserve strides - out = np.empty_like(a, dtype=np.int64) + out = np.empty_like(a, dtype=np.intp) idx = np.ndindex(a.shape[:-1]) # Numpy default partition axis is -1 for s in idx: @@ -1924,7 +1924,7 @@ def np_argpartition(a, kth): def np_argpartition_impl(a, kth): a_tmp = _asarray(a) if a_tmp.size == 0: - return a_tmp.copy().astype('int64') + return a_tmp.copy().astype('intp') else: kth_array = valid_kths(a_tmp, kth) return np_argpartition_impl_inner(a_tmp, kth_array) diff --git a/numba/tests/test_np_functions.py b/numba/tests/test_np_functions.py index 49e8422af0b..7d58d12df0c 100644 --- a/numba/tests/test_np_functions.py +++ b/numba/tests/test_np_functions.py @@ -2218,11 +2218,12 @@ def test_argpartition_basic(self): cfunc = jit(nopython=True)(pyfunc) d = np.array([], dtype=np.int64) + expected = pyfunc(d, 0) got = cfunc(d, 0) - self.assertPreciseEqual(d, got) + self.assertPreciseEqual(expected, got) d = np.ones(1, dtype=np.int64) - expected = np.zeros(1, dtype=np.int64) + expected = pyfunc(d, 0) got = cfunc(d, 0) self.assertPreciseEqual(expected, got) diff --git a/numba/tests/test_ufuncs.py b/numba/tests/test_ufuncs.py index 0ebd1fdb726..f6248f41aab 100644 --- a/numba/tests/test_ufuncs.py +++ b/numba/tests/test_ufuncs.py @@ -1347,6 +1347,7 @@ class _LoopTypesTester(TestCase): ('log10', 'D'): 5, ('tanh', 'F'): 2, ('cbrt', 'd'): 2, + ('logaddexp2', 'd'): 2, } def _arg_for_type(self, a_letter_type, index=0):