From 0cfbd3c4646aa867b89da2aef16c3a0c693d0303 Mon Sep 17 00:00:00 2001 From: Daiki Shintani <35782950+dshintani404@users.noreply.github.com> Date: Fri, 20 Jan 2023 02:20:49 +0900 Subject: 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 --- numpy/core/getlimits.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'numpy/core/getlimits.py') 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: -- cgit v1.2.1