Visitar URL original
gh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE by skirpichev 路 Pull Request #119701 路 python/cpython 路 GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,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
-------

3 changes: 3 additions & 0 deletions Include/pymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@

// Py_IS_NAN(X)
// Return 1 if float or double arg is a NaN, else 0.
Comment thread
skirpichev marked this conversation as resolved.
// 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Macros ``Py_IS_NAN``, ``Py_IS_INFINITY`` and ``Py_IS_FINITE``
are :term:`soft deprecated`.