From 39c840ab6811ec8c630d98ec10478481014d2877 Mon Sep 17 00:00:00 2001 From: "eloisa.bennetts" <49991958+epbennetts@users.noreply.github.com> Date: Mon, 22 Sep 2025 15:53:25 +0200 Subject: [PATCH] Revert "[3.13] gh-136006: fix `Py_NAN` expansion on Solaris systems (GH-136575) (#138734)" This reverts commit df349036b3f912e539643d91b84cbce32e4a1051 as discussed in https://github.com/python/cpython/pull/138733#issuecomment-3317818806 --- Include/pymath.h | 17 +---------------- ...25-07-08-22-07-54.gh-issue-136006.XRU5w4.rst | 2 -- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 Misc/NEWS.d/next/C API/2025-07-08-22-07-54.gh-issue-136006.XRU5w4.rst diff --git a/Include/pymath.h b/Include/pymath.h index cfae2477d7fce3..4c1e3d9984894b 100644 --- a/Include/pymath.h +++ b/Include/pymath.h @@ -54,24 +54,9 @@ /* Py_NAN: Value that evaluates to a quiet Not-a-Number (NaN). The sign is * undefined and normally not relevant, but e.g. fixed for float("nan"). - * - * Note: On Solaris, NAN is a function address, hence arithmetic is impossible. - * For that reason, we instead use the built-in call if available or fallback - * to a generic NaN computed from strtod() as a last resort. - * - * See https://github.com/python/cpython/issues/136006 for details. */ #if !defined(Py_NAN) -# if defined(__sun) -# if _Py__has_builtin(__builtin_nanf) -# define Py_NAN ((double)__builtin_nanf("")) -# else -# include -# define Py_NAN (strtod("NAN", NULL)) -# endif -# else -# define Py_NAN ((double)NAN) -# endif +# define Py_NAN ((double)NAN) #endif #endif /* Py_PYMATH_H */ diff --git a/Misc/NEWS.d/next/C API/2025-07-08-22-07-54.gh-issue-136006.XRU5w4.rst b/Misc/NEWS.d/next/C API/2025-07-08-22-07-54.gh-issue-136006.XRU5w4.rst deleted file mode 100644 index 2165e535b12245..00000000000000 --- a/Misc/NEWS.d/next/C API/2025-07-08-22-07-54.gh-issue-136006.XRU5w4.rst +++ /dev/null @@ -1,2 +0,0 @@ -On Solaris, the :c:macro:`!Py_NAN` macro now expands to a :c:type:`!double` -instead of a function address. Patch by Bénédikt Tran.