Message412625
Python uses Py_NAN without "#ifdef Py_NAN" guard since 2008. Building Python with Py_NO_NAN never worked. Nobody reported such build failure in the last 14 years...
IMO it's time to stop supporting platforms without NaN support.
> Objects/complexobject.c:120:27: error: use of undeclared identifier 'Py_NAN'
I only try a few Python versions: I reproduce this issue in Python 3.11, 3.5, 3.2 and... even Python 2.7!
The Py_NO_NAN macro was introduced in Python 2.6 (2007) by bpo-1635 "Float patch for inf and nan on Windows (and other platforms)":
--
commit 0a8143f6462b491d3f12bfb899efd6e044e350be
Author: Christian Heimes <christian@cheimes.de>
Date: Tue Dec 18 23:22:54 2007 +0000
Applied patch #1635: Float patch for inf and nan on Windows (and other platforms).
The patch unifies float("inf") and repr(float("inf")) on all platforms.
(...)
+#if !defined(Py_NAN) && !defined(Py_NO_NAN)
+#define Py_NAN (Py_HUGE_VAL * 0.)
+#endif
---
The following change started to use Py_NAN in many C files:
* Modules/cmathmodule.c
* Objects/complexobject.c
* Objects/floatobject.c
* Python/pymath.c
---
commit 6f34109384f3a78d5f4f8bdd418a89caca19631e (HEAD)
Author: Christian Heimes <christian@cheimes.de>
Date: Fri Apr 18 23:13:07 2008 +0000
I finally got the time to update and merge Mark's and my trunk-math branch. The patch is collaborated w
ork of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and
edge cases related to operations with NaN, INF, very small values and complex math.
The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differen
ces between platforms like different results or exceptions for edge cases. Have fun :)
---
At this commit, floatobject.c and pymath.c use "#ifdef Py_NAN" carefully, whereas cmathmodule.c and complexobject.c use Py_NAN with no "#ifdef Py_NAN" guard. |
|
Date |
User |
Action |
Args |
2022-02-06 12:29:29 | vstinner | set | recipients:
+ vstinner, mark.dickinson |
2022-02-06 12:29:29 | vstinner | set | messageid: <1644150569.72.0.748485008652.issue46656@roundup.psfhosted.org> |
2022-02-06 12:29:29 | vstinner | link | issue46656 messages |
2022-02-06 12:29:29 | vstinner | create | |
|