STINNER Victor <vstin...@python.org> added the comment:

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 <christ...@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 <christ...@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.

----------
nosy: +vstinner

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46656>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to