summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-08-25 02:10:39 (GMT)
committerGitHub <noreply@github.com>2019-08-25 02:10:39 (GMT)
commitaef9ad82f7f667cd001a7112d3bc636e918626f7 (patch)
tree71bc842de3236a77c6084e951ecf6061693705c0 /Python/getargs.c
parent805f8f9afea116c5d4d000570e3d02ae84502f43 (diff)
downloadcpython-aef9ad82f7f667cd001a7112d3bc636e918626f7.zip
cpython-aef9ad82f7f667cd001a7112d3bc636e918626f7.tar.gz
cpython-aef9ad82f7f667cd001a7112d3bc636e918626f7.tar.bz2
bpo-37942: Improve argument clinic float converter (GH-15470)
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index cdc16d4..fe6474c 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;