mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-31373: remove overly strict float range checks (#3486)
This undoes a853a8ba78
except for the pytime.c
parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be
rounded into finite floats. Tests were added to very this behavior.
This commit is contained in:
parent
252033d50e
commit
2bb69a5b4e
4 changed files with 14 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue