From: Steven Hiscocks Date: Thu, 15 Aug 2013 16:50:32 +0000 (-0400) Subject: systemd-python: fix initialization of _Reader objects X-Git-Tag: v207~121 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c2748ce28c7111037f312c5446335f5538e673e8;p=elogind.git systemd-python: fix initialization of _Reader objects https://bugzilla.redhat.com/show_bug.cgi?id=995575 --- diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c index a678f6931..3b1003ba7 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;