From aef9ad82f7f667cd001a7112d3bc636e918626f7 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 24 Aug 2019 19:10:39 -0700 Subject: bpo-37942: Improve argument clinic float converter (GH-15470) --- Python/getargs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/getargs.c') diff --git a/Python/getargs.c b/Python/getargs.c index cdc16d4730..fe6474c181 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -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; -- cgit v1.2.1