Skip to content

Commit a755410

Browse files
closes bpo-39415: Remove unused codes from longobject.c complexobject.c floatobject.c. (GH-18105)
(cherry picked from commit 0d5eac8) Co-authored-by: Dong-hee Na <[email protected]>
1 parent 41b3e87 commit a755410

File tree

3 files changed

+0
-68
lines changed

3 files changed

+0
-68
lines changed

Objects/complexobject.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -743,29 +743,9 @@ complex__format__(PyObject* self, PyObject* args)
743743
return _PyUnicodeWriter_Finish(&writer);
744744
}
745745

746-
#if 0
747-
static PyObject *
748-
complex_is_finite(PyObject *self)
749-
{
750-
Py_complex c;
751-
c = ((PyComplexObject *)self)->cval;
752-
return PyBool_FromLong((long)(Py_IS_FINITE(c.real) &&
753-
Py_IS_FINITE(c.imag)));
754-
}
755-
756-
PyDoc_STRVAR(complex_is_finite_doc,
757-
"complex.is_finite() -> bool\n"
758-
"\n"
759-
"Returns True if the real and the imaginary part is finite.");
760-
#endif
761-
762746
static PyMethodDef complex_methods[] = {
763747
{"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS,
764748
complex_conjugate_doc},
765-
#if 0
766-
{"is_finite", (PyCFunction)complex_is_finite, METH_NOARGS,
767-
complex_is_finite_doc},
768-
#endif
769749
{"__getnewargs__", (PyCFunction)complex_getnewargs, METH_NOARGS},
770750
{"__format__", (PyCFunction)complex__format__,
771751
METH_VARARGS, complex__format__doc},

Objects/floatobject.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -861,35 +861,6 @@ float_is_integer_impl(PyObject *self)
861861
return o;
862862
}
863863

864-
#if 0
865-
static PyObject *
866-
float_is_inf(PyObject *v)
867-
{
868-
double x = PyFloat_AsDouble(v);
869-
if (x == -1.0 && PyErr_Occurred())
870-
return NULL;
871-
return PyBool_FromLong((long)Py_IS_INFINITY(x));
872-
}
873-
874-
static PyObject *
875-
float_is_nan(PyObject *v)
876-
{
877-
double x = PyFloat_AsDouble(v);
878-
if (x == -1.0 && PyErr_Occurred())
879-
return NULL;
880-
return PyBool_FromLong((long)Py_IS_NAN(x));
881-
}
882-
883-
static PyObject *
884-
float_is_finite(PyObject *v)
885-
{
886-
double x = PyFloat_AsDouble(v);
887-
if (x == -1.0 && PyErr_Occurred())
888-
return NULL;
889-
return PyBool_FromLong((long)Py_IS_FINITE(x));
890-
}
891-
#endif
892-
893864
/*[clinic input]
894865
float.__trunc__
895866
@@ -1852,14 +1823,6 @@ static PyMethodDef float_methods[] = {
18521823
FLOAT_FROMHEX_METHODDEF
18531824
FLOAT_HEX_METHODDEF
18541825
FLOAT_IS_INTEGER_METHODDEF
1855-
#if 0
1856-
{"is_inf", (PyCFunction)float_is_inf, METH_NOARGS,
1857-
"Return True if the float is positive or negative infinite."},
1858-
{"is_finite", (PyCFunction)float_is_finite, METH_NOARGS,
1859-
"Return True if the float is finite, neither infinite nor NaN."},
1860-
{"is_nan", (PyCFunction)float_is_nan, METH_NOARGS,
1861-
"Return True if the float is not a number (NaN)."},
1862-
#endif
18631826
FLOAT___GETNEWARGS___METHODDEF
18641827
FLOAT___GETFORMAT___METHODDEF
18651828
FLOAT___SET_FORMAT___METHODDEF

Objects/longobject.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5464,13 +5464,6 @@ int_bit_length_impl(PyObject *self)
54645464
return NULL;
54655465
}
54665466

5467-
#if 0
5468-
static PyObject *
5469-
long_is_finite(PyObject *v)
5470-
{
5471-
Py_RETURN_TRUE;
5472-
}
5473-
#endif
54745467

54755468
/*[clinic input]
54765469
int.as_integer_ratio
@@ -5628,10 +5621,6 @@ static PyMethodDef long_methods[] = {
56285621
{"conjugate", long_long_meth, METH_NOARGS,
56295622
"Returns self, the complex conjugate of any int."},
56305623
INT_BIT_LENGTH_METHODDEF
5631-
#if 0
5632-
{"is_finite", (PyCFunction)long_is_finite, METH_NOARGS,
5633-
"Returns always True."},
5634-
#endif
56355624
INT_TO_BYTES_METHODDEF
56365625
INT_FROM_BYTES_METHODDEF
56375626
INT_AS_INTEGER_RATIO_METHODDEF

0 commit comments

Comments
 (0)