diff options
author | mattip <matti.picus@gmail.com> | 2019-09-23 12:44:41 +0300 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2019-09-23 20:23:52 +0300 |
commit | 65e91e4d711b86fe2705202251791a2e30a3c075 (patch) | |
tree | 597778d1327ef77ff6dda5e2381e5abd0d30d278 /numpy/lib/function_base.py | |
parent | 2d1bc73d667ae6ac425cfd05a85d3727b0570115 (diff) | |
download | numpy-65e91e4d711b86fe2705202251791a2e30a3c075.tar.gz |
DEP: remove expired deprecation in select
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. |