summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/python-systemd/_reader.c9
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;