diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-08-25 02:45:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-25 02:45:12 (GMT) |
commit | 21161d73d979012ec3b7247261178b3aa1555486 (patch) | |
tree | 84103ff184fb812a7fcc366401418c6e0d6f0518 /Python/getargs.c | |
parent | bf99801cf74347f0feaac2bf05842dcfa825963d (diff) | |
download | cpython-21161d73d979012ec3b7247261178b3aa1555486.zip cpython-21161d73d979012ec3b7247261178b3aa1555486.tar.gz cpython-21161d73d979012ec3b7247261178b3aa1555486.tar.bz2 |
[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
(cherry picked from commit aef9ad82f7f667cd001a7112d3bc636e918626f7)
Diffstat (limited to 'Python/getargs.c')
-rw-r--r-- | Python/getargs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 59f0fda..051ebc7 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; |