chiark / gitweb /
systemd-python: fix initialization of _Reader objects
[elogind.git] / src / python-systemd / _reader.c
index a678f69318055c94b14179aa3f13a7771d5b1a21..3b1003ba71f99e5a621ac622b7ab7a370947d607 100644 (file)
@@ -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;