gh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE by skirpichev · Pull Request #119701 · python/cpython · GitHub
Skip to content
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.14.rst
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