mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
bpo-37942: Improve argument clinic float converter (GH-15470)
This commit is contained in:
parent
805f8f9afe
commit
aef9ad82f7
10 changed files with 317 additions and 112 deletions
|
@ -887,7 +887,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
case 'f': {/* float */
|
||||
float *p = va_arg(*p_va, float *);
|
||||
double dval = PyFloat_AsDouble(arg);
|
||||
if (PyErr_Occurred())
|
||||
if (dval == -1.0 && PyErr_Occurred())
|
||||
RETURN_ERR_OCCURRED;
|
||||
else
|
||||
*p = (float) dval;
|
||||
|
@ -897,7 +897,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
case 'd': {/* double */
|
||||
double *p = va_arg(*p_va, double *);
|
||||
double dval = PyFloat_AsDouble(arg);
|
||||
if (PyErr_Occurred())
|
||||
if (dval == -1.0 && PyErr_Occurred())
|
||||
RETURN_ERR_OCCURRED;
|
||||
else
|
||||
*p = dval;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue