# HG changeset patch # Parent 2b5e5a3a805e9d0a1da59b2f536a7d7af0f5cc8c Issue #18842: Remove code for unimplemented float.is_finite() etc diff -r 2b5e5a3a805e Objects/complexobject.c --- a/Objects/complexobject.c Sun Jan 29 23:37:56 2017 +0000 +++ b/Objects/complexobject.c Mon Jan 30 00:03:41 2017 +0000 @@ -721,29 +721,9 @@ return _PyUnicodeWriter_Finish(&writer); } -#if 0 -static PyObject * -complex_is_finite(PyObject *self) -{ - Py_complex c; - c = ((PyComplexObject *)self)->cval; - return PyBool_FromLong((long)(Py_IS_FINITE(c.real) && - Py_IS_FINITE(c.imag))); -} - -PyDoc_STRVAR(complex_is_finite_doc, -"complex.is_finite() -> bool\n" -"\n" -"Returns True if the real and the imaginary part is finite."); -#endif - static PyMethodDef complex_methods[] = { {"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS, complex_conjugate_doc}, -#if 0 - {"is_finite", (PyCFunction)complex_is_finite, METH_NOARGS, - complex_is_finite_doc}, -#endif {"__getnewargs__", (PyCFunction)complex_getnewargs, METH_NOARGS}, {"__format__", (PyCFunction)complex__format__, METH_VARARGS, complex__format__doc}, diff -r 2b5e5a3a805e Objects/floatobject.c --- a/Objects/floatobject.c Sun Jan 29 23:37:56 2017 +0000 +++ b/Objects/floatobject.c Mon Jan 30 00:03:41 2017 +0000 @@ -847,35 +847,6 @@ return o; } -#if 0 -static PyObject * -float_is_inf(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_INFINITY(x)); -} - -static PyObject * -float_is_nan(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_NAN(x)); -} - -static PyObject * -float_is_finite(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_FINITE(x)); -} -#endif - static PyObject * float_trunc(PyObject *v) { @@ -1786,14 +1757,6 @@ METH_NOARGS, float_hex_doc}, {"is_integer", (PyCFunction)float_is_integer, METH_NOARGS, "Return True if the float is an integer."}, -#if 0 - {"is_inf", (PyCFunction)float_is_inf, METH_NOARGS, - "Return True if the float is positive or negative infinite."}, - {"is_finite", (PyCFunction)float_is_finite, METH_NOARGS, - "Return True if the float is finite, neither infinite nor NaN."}, - {"is_nan", (PyCFunction)float_is_nan, METH_NOARGS, - "Return True if the float is not a number (NaN)."}, -#endif {"__getnewargs__", (PyCFunction)float_getnewargs, METH_NOARGS}, {"__getformat__", (PyCFunction)float_getformat, METH_O|METH_CLASS, float_getformat_doc}, diff -r 2b5e5a3a805e Objects/longobject.c --- a/Objects/longobject.c Sun Jan 29 23:37:56 2017 +0000 +++ b/Objects/longobject.c Mon Jan 30 00:03:41 2017 +0000 @@ -5136,14 +5136,6 @@ >>> (37).bit_length()\n\ 6"); -#if 0 -static PyObject * -long_is_finite(PyObject *v) -{ - Py_RETURN_TRUE; -} -#endif - static PyObject * long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds) @@ -5310,10 +5302,6 @@ "Returns self, the complex conjugate of any int."}, {"bit_length", (PyCFunction)long_bit_length, METH_NOARGS, long_bit_length_doc}, -#if 0 - {"is_finite", (PyCFunction)long_is_finite, METH_NOARGS, - "Returns always True."}, -#endif {"to_bytes", (PyCFunction)long_to_bytes, METH_VARARGS|METH_KEYWORDS, long_to_bytes_doc}, {"from_bytes", (PyCFunction)long_from_bytes,