summaryrefslogtreecommitdiff
path: root/numpy/lib/index_tricks.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2013-09-09 22:41:03 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2013-09-09 22:43:15 +0200
commit906a8848a3ea7eb0c5fa85653640b37caa08bbcd (patch)
tree9ef2e4de48c67a0084fd5a627a8d02d8ae7c27ef /numpy/lib/index_tricks.py
parentc9b06111227f7a4ec213571f97e1b8d19b9c23f5 (diff)
downloadnumpy-906a8848a3ea7eb0c5fa85653640b37caa08bbcd.tar.gz
BUG: Fix 0-sized ndindex
The zerosize_ok flag to nditer was missing, so that it did not allow for 0-sized iteration. Closes gh-3714
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r--numpy/lib/index_tricks.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index 570cd0f1d..f0066be81 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -540,7 +540,8 @@ class ndindex(object):
if len(shape) == 1 and isinstance(shape[0], tuple):
shape = shape[0]
x = as_strided(_nx.zeros(1), shape=shape, strides=_nx.zeros_like(shape))
- self._it = _nx.nditer(x, flags=['multi_index'], order='C')
+ self._it = _nx.nditer(x, flags=['multi_index', 'zerosize_ok'],
+ order='C')
def __iter__(self):
return self