diff options
Diffstat (limited to 'glib/pygmainloop.c')
| -rw-r--r-- | glib/pygmainloop.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/glib/pygmainloop.c b/glib/pygmainloop.c index d9f048c..de74971 100644 --- a/glib/pygmainloop.c +++ b/glib/pygmainloop.c @@ -285,12 +285,17 @@ pyg_main_loop_dealloc(PyGMainLoop *self) PyObject_Del(self); } -static int -pyg_main_loop_compare(PyGMainLoop *self, PyGMainLoop *v) +static PyObject* +pyg_main_loop_richcompare(PyObject *self, PyObject *other, int op) { - if (self->loop == v->loop) return 0; - if (self->loop > v->loop) return -1; - return 1; + if (Py_TYPE(self) == Py_TYPE(other) && Py_TYPE(self) == &PyGMainLoop_Type) + return _pyglib_generic_ptr_richcompare(((PyGMainLoop*)self)->loop, + ((PyGMainLoop*)other)->loop, + op); + else { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } } static PyObject * @@ -346,7 +351,7 @@ void pyglib_mainloop_register_types(PyObject *d) { PyGMainLoop_Type.tp_dealloc = (destructor)pyg_main_loop_dealloc; - PyGMainLoop_Type.tp_compare = (cmpfunc)pyg_main_loop_compare; + PyGMainLoop_Type.tp_richcompare = pyg_main_loop_richcompare; PyGMainLoop_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; PyGMainLoop_Type.tp_methods = _PyGMainLoop_methods; PyGMainLoop_Type.tp_init = (initproc)pyg_main_loop_init; |
