Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 47889:4bf84035cb5f legacy-trunk
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.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sat, 05 Jul 2008 11:33:52 +0000 |
| parents | 3ada46f2321d |
| children | 0738119c1ef8 |
line wrap: on
line diff
--- a/Objects/floatobject.c Sat Jul 05 10:13:36 2008 +0000 +++ b/Objects/floatobject.c Sat Jul 05 11:33:52 2008 +0000 @@ -246,6 +246,9 @@ 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;
