mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-23699: Use a macro to reduce boilerplate code in rich comparison functions (GH-793)
This commit is contained in:
parent
4f469c0966
commit
e8b1965639
16 changed files with 75 additions and 316 deletions
|
|
@ -1929,27 +1929,7 @@ kqueue_event_richcompare(kqueue_event_Object *s, kqueue_event_Object *o,
|
|||
: 0;
|
||||
#undef CMP
|
||||
|
||||
switch (op) {
|
||||
case Py_EQ:
|
||||
result = (result == 0);
|
||||
break;
|
||||
case Py_NE:
|
||||
result = (result != 0);
|
||||
break;
|
||||
case Py_LE:
|
||||
result = (result <= 0);
|
||||
break;
|
||||
case Py_GE:
|
||||
result = (result >= 0);
|
||||
break;
|
||||
case Py_LT:
|
||||
result = (result < 0);
|
||||
break;
|
||||
case Py_GT:
|
||||
result = (result > 0);
|
||||
break;
|
||||
}
|
||||
return PyBool_FromLong((long)result);
|
||||
Py_RETURN_RICHCOMPARE(result, 0, op);
|
||||
}
|
||||
|
||||
static PyTypeObject kqueue_event_Type = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue