Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66f2623

Browse files
committed
Remove some unecessary '#ifdef Py_NAN's from floatobject.c
1 parent 24bcc61 commit 66f2623

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

Objects/floatobject.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,11 @@ float_div(PyObject *v, PyObject *w)
575575
double a,b;
576576
CONVERT_TO_DOUBLE(v, a);
577577
CONVERT_TO_DOUBLE(w, b);
578-
#ifdef Py_NAN
579578
if (b == 0.0) {
580579
PyErr_SetString(PyExc_ZeroDivisionError,
581580
"float division by zero");
582581
return NULL;
583582
}
584-
#endif
585583
PyFPE_START_PROTECT("divide", return 0)
586584
a = a / b;
587585
PyFPE_END_PROTECT(a)
@@ -595,13 +593,11 @@ float_rem(PyObject *v, PyObject *w)
595593
double mod;
596594
CONVERT_TO_DOUBLE(v, vx);
597595
CONVERT_TO_DOUBLE(w, wx);
598-
#ifdef Py_NAN
599596
if (wx == 0.0) {
600597
PyErr_SetString(PyExc_ZeroDivisionError,
601598
"float modulo");
602599
return NULL;
603600
}
604-
#endif
605601
PyFPE_START_PROTECT("modulo", return 0)
606602
mod = fmod(vx, wx);
607603
/* note: checking mod*wx < 0 is incorrect -- underflows to
@@ -1492,13 +1488,11 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
14921488
"Cannot pass infinity to float.as_integer_ratio.");
14931489
return NULL;
14941490
}
1495-
#ifdef Py_NAN
14961491
if (Py_IS_NAN(self)) {
14971492
PyErr_SetString(PyExc_ValueError,
14981493
"Cannot pass NaN to float.as_integer_ratio.");
14991494
return NULL;
15001495
}
1501-
#endif
15021496

15031497
PyFPE_START_PROTECT("as_integer_ratio", goto error);
15041498
float_part = frexp(self, &exponent); /* self == float_part * 2**exponent exactly */

0 commit comments

Comments
 (0)