diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2019-09-26 09:36:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-26 09:36:45 -0700 |
commit | cb89f88af361f045c560886b1268038ba5ea9cc2 (patch) | |
tree | 65301c9c0e3d0750093ad7890341f809460d8f9d /numpy/lib/function_base.py | |
parent | 504ba4bd9d414fecbfe61c511adf0027208e29e2 (diff) | |
parent | 65e91e4d711b86fe2705202251791a2e30a3c075 (diff) | |
download | numpy-cb89f88af361f045c560886b1268038ba5ea9cc2.tar.gz |
Merge pull request #14583 from mattip/select-deprecation
DEP: remove deprecated select behaviour
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index e39bbf63a..ebf918012 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -682,11 +682,7 @@ def select(condlist, choicelist, default=0): # Now that the dtype is known, handle the deprecated select([], []) case if len(condlist) == 0: - # 2014-02-24, 1.9 - warnings.warn("select with an empty condition list is not possible" - "and will be deprecated", - DeprecationWarning, stacklevel=3) - return np.asarray(default)[()] + raise ValueError("select with an empty condition list is not possible") choicelist = [np.asarray(choice) for choice in choicelist] choicelist.append(np.asarray(default)) @@ -702,25 +698,11 @@ def select(condlist, choicelist, default=0): choicelist = np.broadcast_arrays(*choicelist) # If cond array is not an ndarray in boolean format or scalar bool, abort. - deprecated_ints = False for i in range(len(condlist)): cond = condlist[i] if cond.dtype.type is not np.bool_: - if np.issubdtype(cond.dtype, np.integer): - # A previous implementation accepted int ndarrays accidentally. - # Supported here deliberately, but deprecated. - condlist[i] = condlist[i].astype(bool) - deprecated_ints = True - else: - raise ValueError( - 'invalid entry {} in condlist: should be boolean ndarray'.format(i)) - - if deprecated_ints: - # 2014-02-24, 1.9 - msg = "select condlists containing integer ndarrays is deprecated " \ - "and will be removed in the future. Use `.astype(bool)` to " \ - "convert to bools." - warnings.warn(msg, DeprecationWarning, stacklevel=3) + raise TypeError( + 'invalid entry {} in condlist: should be boolean ndarray'.format(i)) if choicelist[0].ndim == 0: # This may be common, so avoid the call. |