summaryrefslogtreecommitdiff
path: root/numpy/core/shape_base.py
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@google.com>2018-10-27 13:09:23 -0700
committerStephan Hoyer <shoyer@google.com>2018-10-27 13:09:23 -0700
commitced6475d519552455cc50831052213c1249a909c (patch)
tree4d2c44880ca434837a456611371b8563fa0eadbe /numpy/core/shape_base.py
parentbfe0921f9bdd6b347982a9c998b8b1890040ba5b (diff)
downloadnumpy-ced6475d519552455cc50831052213c1249a909c.tar.gz
MAINT: warn when passing map to stack functions, too
Diffstat (limited to 'numpy/core/shape_base.py')
-rw-r--r--numpy/core/shape_base.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index 4cb7a30f4..22ce47162 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -207,12 +207,12 @@ def atleast_3d(*arys):
def _arrays_for_stack_dispatcher(arrays, stacklevel=4):
- if isinstance(arrays, types.GeneratorType):
- warnings.warn('arrays to stack should be passed as a sequence, not a '
- 'generator. Support for generators is deprecated as of '
+ if hasattr(arrays, '__iter__') and not hasattr(arrays, '__getitem__'):
+ warnings.warn('arrays to stack must be passed as a sequence. Support '
+ 'for non-sequence iterables is deprecated as of '
'NumPy 1.16 and will raise an error in the future. '
'Note also that dispatch with __array_function__ is not '
- 'supported when passing arrays as a generator.',
+ 'supported when arrays are not provided as a sequence.',
FutureWarning, stacklevel=stacklevel)
return ()
return arrays