diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-11-12 17:17:24 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-12 17:17:24 -0600 |
commit | 067264b20f8d2c043cf5b9cd3d1826384e558e79 (patch) | |
tree | 4714149704808160daa1ee9b2bdaa9cfab2672d8 /numpy/lib | |
parent | e34f5bb4e3aad2bb35fb6d9e3a5c1bfc85eb97eb (diff) | |
parent | 9fa3a4e9802b32c985f6a1fc14dd315a2656ac38 (diff) | |
download | numpy-067264b20f8d2c043cf5b9cd3d1826384e558e79.tar.gz |
Merge pull request #12362 from shoyer/disable-array-function-by-default
MAINT: disable `__array_function__` dispatch unless environment variable set
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/shape_base.py | 5 | ||||
-rw-r--r-- | numpy/lib/ufunclike.py | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 6e7cab3fa..f56c4f4db 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -11,7 +11,8 @@ from numpy.core.fromnumeric import product, reshape, transpose from numpy.core.multiarray import normalize_axis_index from numpy.core import overrides from numpy.core import vstack, atleast_3d -from numpy.core.shape_base import _arrays_for_stack_dispatcher +from numpy.core.shape_base import ( + _arrays_for_stack_dispatcher, _warn_for_nonsequence) from numpy.lib.index_tricks import ndindex from numpy.matrixlib.defmatrix import matrix # this raises all the right alarm bells @@ -629,6 +630,7 @@ def column_stack(tup): [3, 4]]) """ + _warn_for_nonsequence(tup) arrays = [] for v in tup: arr = array(v, copy=False, subok=True) @@ -693,6 +695,7 @@ def dstack(tup): [[3, 4]]]) """ + _warn_for_nonsequence(tup) return _nx.concatenate([atleast_3d(_m) for _m in tup], 2) diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py index ac0af0b37..9a9e6f9dd 100644 --- a/numpy/lib/ufunclike.py +++ b/numpy/lib/ufunclike.py @@ -8,7 +8,7 @@ from __future__ import division, absolute_import, print_function __all__ = ['fix', 'isneginf', 'isposinf'] import numpy.core.numeric as nx -from numpy.core.overrides import array_function_dispatch +from numpy.core.overrides import array_function_dispatch, ENABLE_ARRAY_FUNCTION import warnings import functools @@ -55,6 +55,10 @@ def _fix_out_named_y(f): return func +if not ENABLE_ARRAY_FUNCTION: + _fix_out_named_y = _deprecate_out_named_y + + @_deprecate_out_named_y def _dispatcher(x, out=None): return (x, out) |