Skip to content

Commit 4933484

Browse files
committed
bpo-39415: Remove unused codes from longobject.c complexobject.c floatobject.c
1 parent 56cd371 commit 4933484

File tree

3 files changed

+0
-68
lines changed

3 files changed

+0
-68
lines changed

Objects/complexobject.c

-20
Original file line numberDiff line numberDiff line change
@@ -731,29 +731,9 @@ complex__format__(PyObject* self, PyObject* args)
731731
return _PyUnicodeWriter_Finish(&writer);
732732
}
733733

734-
#if 0
735-
static PyObject *
736-
complex_is_finite(PyObject *self)
737-
{
738-
Py_complex c;
739-
c = ((PyComplexObject *)self)->cval;
740-
return PyBool_FromLong((long)(Py_IS_FINITE(c.real) &&
741-
Py_IS_FINITE(c.imag)));
742-
}
743-
744-
PyDoc_STRVAR(complex_is_finite_doc,
745-
"complex.is_finite() -> bool\n"
746-
"\n"
747-
"Returns True if the real and the imaginary part is finite.");
748-
#endif
749-
750734
static PyMethodDef complex_methods[] = {
751735
{"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS,
752736
complex_conjugate_doc},
753-
#if 0
754-
{"is_finite", (PyCFunction)complex_is_finite, METH_NOARGS,
755-
complex_is_finite_doc},
756-
#endif
757737
{"__getnewargs__", (PyCFunction)complex_getnewargs, METH_NOARGS},
758738
{"__format__", (PyCFunction)complex__format__,
759739
METH_VARARGS, complex__format__doc},

Objects/floatobject.c

-37
Original file line numberDiff line numberDiff line change
@@ -843,35 +843,6 @@ float_is_integer_impl(PyObject *self)
843843
return o;
844844
}
845845

846-
#if 0
847-
static PyObject *
848-
float_is_inf(PyObject *v)
849-
{
850-
double x = PyFloat_AsDouble(v);
851-
if (x == -1.0 && PyErr_Occurred())
852-
return NULL;
853-
return PyBool_FromLong((long)Py_IS_INFINITY(x));
854-
}
855-
856-
static PyObject *
857-
float_is_nan(PyObject *v)
858-
{
859-
double x = PyFloat_AsDouble(v);
860-
if (x == -1.0 && PyErr_Occurred())
861-
return NULL;
862-
return PyBool_FromLong((long)Py_IS_NAN(x));
863-
}
864-
865-
static PyObject *
866-
float_is_finite(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_FINITE(x));
872-
}
873-
#endif
874-
875846
/*[clinic input]
876847
float.__trunc__
877848
@@ -1863,14 +1834,6 @@ static PyMethodDef float_methods[] = {
18631834
FLOAT_FROMHEX_METHODDEF
18641835
FLOAT_HEX_METHODDEF
18651836
FLOAT_IS_INTEGER_METHODDEF
1866-
#if 0
1867-
{"is_inf", (PyCFunction)float_is_inf, METH_NOARGS,
1868-
"Return True if the float is positive or negative infinite."},
1869-
{"is_finite", (PyCFunction)float_is_finite, METH_NOARGS,
1870-
"Return True if the float is finite, neither infinite nor NaN."},
1871-
{"is_nan", (PyCFunction)float_is_nan, METH_NOARGS,
1872-
"Return True if the float is not a number (NaN)."},
1873-
#endif
18741837
FLOAT___GETNEWARGS___METHODDEF
18751838
FLOAT___GETFORMAT___METHODDEF
18761839
FLOAT___SET_FORMAT___METHODDEF

Objects/longobject.c

-11
Original file line numberDiff line numberDiff line change
@@ -5411,13 +5411,6 @@ int_bit_length_impl(PyObject *self)
54115411
return NULL;
54125412
}
54135413

5414-
#if 0
5415-
static PyObject *
5416-
long_is_finite(PyObject *v)
5417-
{
5418-
Py_RETURN_TRUE;
5419-
}
5420-
#endif
54215414

54225415
/*[clinic input]
54235416
int.as_integer_ratio
@@ -5574,10 +5567,6 @@ static PyMethodDef long_methods[] = {
55745567
{"conjugate", long_long_meth, METH_NOARGS,
55755568
"Returns self, the complex conjugate of any int."},
55765569
INT_BIT_LENGTH_METHODDEF
5577-
#if 0
5578-
{"is_finite", (PyCFunction)long_is_finite, METH_NOARGS,
5579-
"Returns always True."},
5580-
#endif
55815570
INT_TO_BYTES_METHODDEF
55825571
INT_FROM_BYTES_METHODDEF
55835572
INT_AS_INTEGER_RATIO_METHODDEF

0 commit comments

Comments
 (0)