diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-29 20:34:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-29 20:34:23 (GMT) |
commit | 0d250bc119489fa7d094d4a3fd2fd2fa0a508145 (patch) | |
tree | 713daa0ef460e7a6744de0748ea829fefe6efb12 /Objects/floatobject.c | |
parent | 5aab44b301fff2c6a7f00e24944a3360eedd7aa8 (diff) | |
download | cpython-0d250bc119489fa7d094d4a3fd2fd2fa0a508145.zip cpython-0d250bc119489fa7d094d4a3fd2fd2fa0a508145.tar.gz cpython-0d250bc119489fa7d094d4a3fd2fd2fa0a508145.tar.bz2 |
Issue #25971: Optimized creating Fractions from floats by 2 times and from
Decimals by 3 times.
Unified error messages in float.as_integer_ratio(), Decimal.as_integer_ratio(),
and Fraction constructors.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index d92bec3..2949174 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1466,14 +1466,14 @@ float_as_integer_ratio(PyObject *v, PyObject *unused) CONVERT_TO_DOUBLE(v, self); if (Py_IS_INFINITY(self)) { - PyErr_SetString(PyExc_OverflowError, - "Cannot pass infinity to float.as_integer_ratio."); - return NULL; + PyErr_SetString(PyExc_OverflowError, + "cannot convert Infinity to integer ratio"); + return NULL; } if (Py_IS_NAN(self)) { - PyErr_SetString(PyExc_ValueError, - "Cannot pass NaN to float.as_integer_ratio."); - return NULL; + PyErr_SetString(PyExc_ValueError, + "cannot convert NaN to integer ratio"); + return NULL; } PyFPE_START_PROTECT("as_integer_ratio", goto error); |