summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorstratakis <cstratak@redhat.com>2017-11-02 10:32:54 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2017-11-02 10:32:54 (GMT)
commite8b19656396381407ad91473af5da8b0d4346e88 (patch)
tree16638970d5014728a49808d0c80c4af0fe6ccb91 /Modules/selectmodule.c
parent4f469c096628af730b17798d0ebfd8925bfde836 (diff)
downloadcpython-e8b19656396381407ad91473af5da8b0d4346e88.zip
cpython-e8b19656396381407ad91473af5da8b0d4346e88.tar.gz
cpython-e8b19656396381407ad91473af5da8b0d4346e88.tar.bz2
bpo-23699: Use a macro to reduce boilerplate code in rich comparison functions (GH-793)
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 1cde6e8..f2f5cc8 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -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 = {