diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-07-05 11:33:52 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-07-05 11:33:52 (GMT) |
commit | bf9f4d801530f4b4f40fe7baf93b1b4d55873275 (patch) | |
tree | 5e0027737673ad3b9a34f262f46b8bd16775a2e0 /Objects | |
parent | e78fbcce3e9fef7d4f701971186baa4bdec6b9b1 (diff) | |
download | cpython-bf9f4d801530f4b4f40fe7baf93b1b4d55873275.zip cpython-bf9f4d801530f4b4f40fe7baf93b1b4d55873275.tar.gz cpython-bf9f4d801530f4b4f40fe7baf93b1b4d55873275.tar.bz2 |
Issue 3188: accept float('infinity') as well as float('inf'). This
makes the float constructor behave in the same way as specified
by various other language standards, including C99, IEEE 754r,
and the IBM Decimal standard.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/floatobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 32e7cc8..83401f2 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -246,6 +246,9 @@ PyFloat_FromString(PyObject *v, char **pend) if (PyOS_strnicmp(p, "inf", 4) == 0) { Py_RETURN_INF(sign); } + if (PyOS_strnicmp(p, "infinity", 9) == 0) { + Py_RETURN_INF(sign); + } #ifdef Py_NAN if(PyOS_strnicmp(p, "nan", 4) == 0) { Py_RETURN_NAN; |