Skip to content

gh-119613: deprecate Py_IS_NAN/INFINITY and Py_IS_FINITE #119701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 29, 2024
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ Porting to Python 3.14
Deprecated
----------

* Deprecate ``Py_IS_NAN``, ``Py_IS_INFINITY`` and ``Py_IS_FINITE`` macros,
use instead ``isnan``, ``isinf`` and ``isfinite`` available from ``<math.h>``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use instead ``isnan``, ``isinf`` and ``isfinite`` available from ``<math.h>``
use instead :c:func:`!isnan`, :c:func:`!isinf` and :c:func:`!isfinite` available from :file:`math.h`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, these are usually macros, e.g.:
https://en.cppreference.com/w/c/numeric/math/isinf

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure; but this is about the markup :)

since C99. (Contributed by Sergey B Kirpichev in :gh:`119613`.)

Removed
-------

4 changes: 4 additions & 0 deletions Include/pymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#define Py_MATH_TAU 6.2831853071795864769252867665590057683943L
#endif

/* Py_IS_NAN, Py_IS_INFINITY and Py_IS_FINITE are deprecated
* since CPython 3.14.
*/

// Py_IS_NAN(X)
// Return 1 if float or double arg is a NaN, else 0.
#define Py_IS_NAN(X) isnan(X)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate ``Py_IS_NAN``, ``Py_IS_INFINITY`` and ``Py_IS_FINITE`` macros.