gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#119619)

This commit is contained in:
Sergey B Kirpichev
2024-05-29 10:51:19 +03:00
committed by GitHub
parent 86d1a1aa88
commit cd11ff12ac
12 changed files with 140 additions and 142 deletions

View File

@@ -842,7 +842,7 @@ char * PyOS_double_to_string(double val,
*/
if (Py_IS_NAN(val) || Py_IS_INFINITY(val))
if (isnan(val) || isinf(val))
/* 3 for 'inf'/'nan', 1 for sign, 1 for '\0' */
bufsize = 5;
else {
@@ -860,10 +860,10 @@ char * PyOS_double_to_string(double val,
}
/* Handle nan and inf. */
if (Py_IS_NAN(val)) {
if (isnan(val)) {
strcpy(buf, "nan");
t = Py_DTST_NAN;
} else if (Py_IS_INFINITY(val)) {
} else if (isinf(val)) {
if (copysign(1., val) == 1.)
strcpy(buf, "inf");
else