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> | 2015-07-05 14:19:21 -0400 |
commit | ec9078e45e25d7484b5f4e08dd69020f57e4d668 (patch) | |
tree | 5493182c901c5204d0492d0fb41ceb16d620e47d /systemd/_reader.c | |
parent | ac8b2b3eb3097b9079d8c5db1f09fcedffab246e (diff) | |
download | python-systemd-ec9078e45e25d7484b5f4e08dd69020f57e4d668.tar.gz |
systemd-python: fix initialization of _Reader objects
https://bugzilla.redhat.com/show_bug.cgi?id=995575
Diffstat (limited to 'systemd/_reader.c')
-rw-r--r-- | systemd/_reader.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/systemd/_reader.c b/systemd/_reader.c index a678f69..3b1003b 100644 --- a/systemd/_reader.c +++ b/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; |