diff options
author | Steven Hiscocks <steven@hiscocks.me.uk> | 2013-08-15 12:50:32 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-08-15 12:59:36 -0400 |
commit | c2748ce28c7111037f312c5446335f5538e673e8 (patch) | |
tree | 9bc541b334a7b8f3ba5f1637fbaef6f5b159ccf9 /src | |
parent | 04bf3c1a60d82791e0320381e9268f727708f776 (diff) |
systemd-python: fix initialization of _Reader objects
https://bugzilla.redhat.com/show_bug.cgi?id=995575
Diffstat (limited to 'src')
-rw-r--r-- | src/python-systemd/_reader.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c index a678f69318..3b1003ba71 100644 --- a/src/python-systemd/_reader.c +++ b/src/python-systemd/_reader.c @@ -64,6 +64,10 @@ static PyStructSequence_Desc Monotonic_desc = { }; #endif +/** + * Convert a Python sequence object into a strv (char**), and + * None into a NULL pointer. + */ static int strv_converter(PyObject* obj, void *_result) { char ***result = _result; Py_ssize_t i, len; @@ -73,6 +77,11 @@ static int strv_converter(PyObject* obj, void *_result) { if (!obj) goto cleanup; + if (obj == Py_None) { + *result = NULL; + return 1; + } + if (!PySequence_Check(obj)) return 0; |