]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701)
authorSergey B Kirpichev <skirpichev@gmail.com>
Wed, 29 May 2024 10:45:14 +0000 (13:45 +0300)
committerGitHub <noreply@github.com>
Wed, 29 May 2024 10:45:14 +0000 (10:45 +0000)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Doc/whatsnew/3.14.rst
Include/pymath.h
Misc/NEWS.d/next/C API/2024-05-29-09-21-37.gh-issue-119613.J2xfrC.rst [new file with mode: 0644]

index 15216479cc6e5c5a58de7690f864b948b26d8a7c..bc7fe64e68bb1891999d441803d70ff2616bdfe3 100644 (file)
@@ -231,6 +231,12 @@ Porting to Python 3.14
 Deprecated
 ----------
 
+* Macros :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY`
+  and :c:macro:`!Py_IS_FINITE` are :term:`soft deprecated`,
+  use instead :c:macro:`!isnan`, :c:macro:`!isinf` and
+  :c:macro:`!isfinite` available from :file:`math.h`
+  since C99.  (Contributed by Sergey B Kirpichev in :gh:`119613`.)
+
 Removed
 -------
 
index 4c1e3d9984894b0cb27dfb387e3e3b8781e14091..d8f763f808d6620360be6f359273a4d696ee8778 100644 (file)
 
 // Py_IS_NAN(X)
 // Return 1 if float or double arg is a NaN, else 0.
+// Soft deprecated since Python 3.14, use isnan() instead.
 #define Py_IS_NAN(X) isnan(X)
 
 // Py_IS_INFINITY(X)
 // Return 1 if float or double arg is an infinity, else 0.
+// Soft deprecated since Python 3.14, use isinf() instead.
 #define Py_IS_INFINITY(X) isinf(X)
 
 // Py_IS_FINITE(X)
 // Return 1 if float or double arg is neither infinite nor NAN, else 0.
+// Soft deprecated since Python 3.14, use isfinite() instead.
 #define Py_IS_FINITE(X) isfinite(X)
 
 // Py_INFINITY: Value that evaluates to a positive double infinity.
diff --git a/Misc/NEWS.d/next/C API/2024-05-29-09-21-37.gh-issue-119613.J2xfrC.rst b/Misc/NEWS.d/next/C API/2024-05-29-09-21-37.gh-issue-119613.J2xfrC.rst
new file mode 100644 (file)
index 0000000..196a472
--- /dev/null
@@ -0,0 +1,2 @@
+Macros ``Py_IS_NAN``, ``Py_IS_INFINITY`` and ``Py_IS_FINITE``
+are :term:`soft deprecated`.