diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | src/python-systemd/_reader.c | 16 |
2 files changed, 14 insertions, 4 deletions
@@ -586,8 +586,6 @@ Features: - allow reading of only select fields in systemd.journal._reader.Reader - export sd_journal_test_cursor in systemd.journal._reader.Reader - export sd_journal_get_usage in systemd.journal._reader.Reader - - add systemd.journal._reader._Reader.closed attribute (it can - be just "return self->j != NULL") - figure out a simple way to wait for journal events in a way that works with ^C - add documentation to systemd.daemon diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c index 6759555c12..67358e3061 100644 --- a/src/python-systemd/_reader.c +++ b/src/python-systemd/_reader.c @@ -666,12 +666,24 @@ static int Reader_set_data_threshold(Reader *self, PyObject *value, void *closur return set_error(r, NULL, NULL); } -static PyGetSetDef Reader_getseters[] = { +PyDoc_STRVAR(closed__doc__, + "True iff journal is closed"); +static PyObject* Reader_get_closed(Reader *self, void *closure) +{ + return PyBool_FromLong(self->j == NULL); +} + +static PyGetSetDef Reader_getsetters[] = { {(char*) "data_threshold", (getter) Reader_get_data_threshold, (setter) Reader_set_data_threshold, (char*) data_threshold__doc__, NULL}, + {(char*) "closed", + (getter) Reader_get_closed, + NULL, + (char*) closed__doc__, + NULL}, {NULL} }; @@ -727,7 +739,7 @@ static PyTypeObject ReaderType = { Reader_iternext, /* tp_iternext */ Reader_methods, /* tp_methods */ 0, /* tp_members */ - Reader_getseters, /* tp_getset */ + Reader_getsetters, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ |