diff options
Diffstat (limited to 'glib/pygmainloop.c')
-rw-r--r-- | glib/pygmainloop.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/glib/pygmainloop.c b/glib/pygmainloop.c index d9f048c..219b6a3 100644 --- a/glib/pygmainloop.c +++ b/glib/pygmainloop.c @@ -158,8 +158,9 @@ pyg_signal_watch_check(GSource *source) PySignalWatchSource *real_source = (PySignalWatchSource *)source; GPollFD *poll_fd = &real_source->fd; unsigned char dummy; + gssize ret; if (poll_fd->revents & G_IO_IN) - read(poll_fd->fd, &dummy, 1); + ret = read(poll_fd->fd, &dummy, 1); #endif state = pyglib_gil_state_ensure(); @@ -285,18 +286,23 @@ 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 * _wrap_g_main_loop_get_context (PyGMainLoop *loop) { - return pyglib_main_context_new(g_main_loop_get_context(loop->loop)); + return pyg_main_context_new(g_main_loop_get_context(loop->loop)); } static PyObject * @@ -346,7 +352,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; |