Skip to content
Snippets Groups Projects
Commit 9bf14e4d authored by Kaushik Kulkarni's avatar Kaushik Kulkarni Committed by Andreas Klöckner
Browse files

make indexing into non-positive dimension axes illegal

parent ea541dac
No related branches found
No related tags found
No related merge requests found
......@@ -521,6 +521,10 @@ def _index_into(ary: Array, indices: Tuple[ConvertibleToIndexExpr, ...]) -> Arra
elif isinstance(idx, Array):
if idx.dtype.kind not in ["i", "u"]:
raise IndexError("only integer arrays are valid array indices")
if (_is_non_positive(ary.shape[i])
and (not are_shape_components_equal(idx.size, 0))):
raise IndexError("Indirect indexing into a non-postive"
f" dimension (axis {i}) is illegal.")
else:
raise IndexError("only integers, slices, ellipsis and integer arrays"
" are valid indices")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment