diff options
author | Stephan Hoyer <shoyer@google.com> | 2018-10-27 13:09:23 -0700 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2018-10-27 13:09:23 -0700 |
commit | ced6475d519552455cc50831052213c1249a909c (patch) | |
tree | 4d2c44880ca434837a456611371b8563fa0eadbe /numpy/core/shape_base.py | |
parent | bfe0921f9bdd6b347982a9c998b8b1890040ba5b (diff) | |
download | numpy-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.py | 8 |
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 |