summaryrefslogtreecommitdiff
path: root/numpy/core/getlimits.py
diff options
context:
space:
mode:
authorDaiki Shintani <35782950+dshintani404@users.noreply.github.com>2023-01-20 02:20:49 +0900
committerGitHub <noreply@github.com>2023-01-19 18:20:49 +0100
commit0cfbd3c4646aa867b89da2aef16c3a0c693d0303 (patch)
tree56bd74ba6009d5fe65d3f7243db0b113bd646b69 /numpy/core/getlimits.py
parente2fccd939e12ba33e90f663fe158d3e7566d031e (diff)
downloadnumpy-0cfbd3c4646aa867b89da2aef16c3a0c693d0303.tar.gz
DEP: deprecate np.finfo(None) (#23011)
Deprecate np.finfo(None), it may be that we should more generally deprecate `np.dtype(None)` but this is a start and particularly weird maybe. Closes gh-14684
Diffstat (limited to 'numpy/core/getlimits.py')
-rw-r--r--numpy/core/getlimits.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/getlimits.py b/numpy/core/getlimits.py
index 5baeb97fe..8146c4644 100644
--- a/numpy/core/getlimits.py
+++ b/numpy/core/getlimits.py
@@ -471,6 +471,15 @@ class finfo:
_finfo_cache = {}
def __new__(cls, dtype):
+ if dtype is None:
+ # Deprecated in NumPy 1.25, 2023-01-16
+ warnings.warn(
+ "finfo() dtype cannot be None. This behavior will "
+ "raise an error in the future. (Deprecated in NumPy 1.25)",
+ DeprecationWarning,
+ stacklevel=2
+ )
+
try:
dtype = numeric.dtype(dtype)
except TypeError: