summaryrefslogtreecommitdiff
path: root/Python/getargs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 4b969d924a..0b155a170f 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -4,6 +4,7 @@
#include "Python.h"
#include <ctype.h>
+#include <float.h>
#ifdef __cplusplus
@@ -858,6 +859,10 @@ 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;