diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 66726d6496d6..a16c05cf5d99 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -617,6 +617,12 @@ def test_float_specials_do_unpack(self): (' FLT_MAX && !Py_IS_INFINITY(x)) + if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) goto Overflow; unsigned char s[sizeof(float)]; - float y = (float)x; memcpy(s, &y, sizeof(float)); if ((float_format == ieee_little_endian_format && !le) diff --git a/Python/getargs.c b/Python/getargs.c index 0b155a170f90..dd7ca9fed15e 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -859,10 +859,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, double dval = PyFloat_AsDouble(arg); if (PyErr_Occurred()) RETURN_ERR_OCCURRED; - else if (dval > FLT_MAX) - *p = (float)INFINITY; - else if (dval < -FLT_MAX) - *p = (float)-INFINITY; else *p = (float) dval; break;