diff options
author | Jaime Fernandez <jaime.frio@gmail.com> | 2015-04-28 22:42:50 -0700 |
---|---|---|
committer | Jaime Fernandez <jaime.frio@gmail.com> | 2015-05-04 20:43:01 -0700 |
commit | c01165f43068fea96722c172eb23efed4ca99763 (patch) | |
tree | 72096386212fa2b1c8d101e848ad26fa702433ce /numpy/lib/index_tricks.py | |
parent | f06b1210d7171b4a452d0c9c67cde7b1a130303e (diff) | |
download | numpy-c01165f43068fea96722c172eb23efed4ca99763.tar.gz |
BUG: Fix handling of non-empty ndarrays
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r-- | numpy/lib/index_tricks.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index 2bb11bf1e..752407f18 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -72,10 +72,12 @@ def ix_(*args): out = [] nd = len(args) for k, new in enumerate(args): - # Explicitly type empty sequences to avoid float default - new = asarray(new, dtype=None if new else _nx.intp) - if (new.ndim != 1): + new = asarray(new) + if new.ndim != 1: raise ValueError("Cross index must be 1 dimensional") + if new.size == 0: + # Explicitly type empty arrays to avoid float default + new = new.astype(_nx.intp) if issubdtype(new.dtype, _nx.bool_): new, = new.nonzero() new.shape = (1,)*k + (new.size,) + (1,)*(nd-k-1) |