pytevent: Define missing TeventFd_Type object
authorPetr Viktorin <pviktori@redhat.com>
Fri, 22 May 2015 11:29:11 +0000 (13:29 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Jun 2015 04:06:18 +0000 (06:06 +0200)
The type objects for Fd was declared but never defined,
resulting in segfaults when it was used.
Define it.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
lib/tevent/pytevent.c

index 4de0e3de7e3900df27defda9a21c6a0c22bd9da3..a495da5385d56f2aabd3653359b37ecf8246b17d 100644 (file)
@@ -415,6 +415,19 @@ static void py_fd_handler(struct tevent_context *ev,
        Py_XDECREF(ret);
 }
 
+static void py_tevent_fp_dealloc(TeventFd_Object *self)
+{
+       talloc_free(self->fd);
+       PyObject_Del(self);
+}
+
+static PyTypeObject TeventFd_Type = {
+       .tp_name = "tevent.Fd",
+       .tp_basicsize = sizeof(TeventFd_Object),
+       .tp_dealloc = (destructor)py_tevent_fp_dealloc,
+       .tp_flags = Py_TPFLAGS_DEFAULT,
+};
+
 static PyObject *py_tevent_context_add_fd(TeventContext_Object *self, PyObject *args)
 {
        int fd, flags;