mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
Rich comparisons fall-out:
- Get rid of float_cmp(). - Renamed Py_TPFLAGS_NEWSTYLENUMBER to Py_TPFLAGS_CHECKTYPES.
This commit is contained in:
parent
6fd867b04d
commit
f916e7aa62
1 changed files with 1 additions and 14 deletions
|
@ -346,16 +346,6 @@ float_compare(PyFloatObject *v, PyFloatObject *w)
|
||||||
return (i < j) ? -1 : (i > j) ? 1 : 0;
|
return (i < j) ? -1 : (i > j) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Needed for the new style number compare slots */
|
|
||||||
static PyObject *
|
|
||||||
float_cmp(PyObject *v, PyObject *w)
|
|
||||||
{
|
|
||||||
double a,b;
|
|
||||||
CONVERT_TO_DOUBLE(v, a);
|
|
||||||
CONVERT_TO_DOUBLE(w, b);
|
|
||||||
return PyInt_FromLong((a < b) ? -1 : (a > b) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static long
|
static long
|
||||||
float_hash(PyFloatObject *v)
|
float_hash(PyFloatObject *v)
|
||||||
{
|
{
|
||||||
|
@ -670,9 +660,6 @@ static PyNumberMethods float_as_number = {
|
||||||
0, /*nb_inplace_and*/
|
0, /*nb_inplace_and*/
|
||||||
0, /*nb_inplace_xor*/
|
0, /*nb_inplace_xor*/
|
||||||
0, /*nb_inplace_or*/
|
0, /*nb_inplace_or*/
|
||||||
|
|
||||||
/* New style slots: */
|
|
||||||
(binaryfunc)float_cmp, /*nb_cmp*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PyTypeObject PyFloat_Type = {
|
PyTypeObject PyFloat_Type = {
|
||||||
|
@ -696,7 +683,7 @@ PyTypeObject PyFloat_Type = {
|
||||||
0, /*tp_getattro*/
|
0, /*tp_getattro*/
|
||||||
0, /*tp_setattro*/
|
0, /*tp_setattro*/
|
||||||
0, /*tp_as_buffer*/
|
0, /*tp_as_buffer*/
|
||||||
Py_TPFLAGS_NEWSTYLENUMBER /*tp_flags*/
|
Py_TPFLAGS_CHECKTYPES /*tp_flags*/
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue