Skip to content

Commit

Permalink
Fix #1079
Browse files Browse the repository at this point in the history
  • Loading branch information
manopapad committed Nov 15, 2023
1 parent 1fa075d commit 8e10a8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cunumeric/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,6 @@ def __setitem__(self, key: Any, value: ndarray) -> None:
"""
check_writeable(self)
if key is None:
raise KeyError("invalid key passed to cunumeric.ndarray")
if value.dtype != self.dtype:
temp = ndarray(value.shape, dtype=self.dtype, inputs=(value,))
temp._thunk.convert(value._thunk)
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/test_set_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def test_basic():
assert x[2] == 3


def test_newaxis():
arr = num.ones((4,))
arr[None] = 1
assert np.array_equal(arr, [1, 1, 1, 1])
arr[None, :] = 2
assert np.array_equal(arr, [2, 2, 2, 2])


ARRAYS_4_3_2_1_0 = [
4 - num.arange(5),
4 - np.arange(5),
Expand Down

0 comments on commit 8e10a8a

Please sign in to comment.