Skip to content

Commit

Permalink
Merge pull request numba#8816 from sklam/misc/farmfix
Browse files Browse the repository at this point in the history
Fix some buildfarm test failures
  • Loading branch information
sklam authored Mar 15, 2023
2 parents 1311388 + ae07d34 commit f54d553
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions numba/np/arraymath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions numba/tests/test_np_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions numba/tests/test_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f54d553

Please sign in to comment.