summaryrefslogtreecommitdiff
path: root/src/python-systemd/pyutil.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-07-17 12:50:13 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-07-17 23:41:10 -0400
commitaffba8e90243526be673ad9f9b306a740b8824a6 (patch)
treedaf8a33909f7d88249006ef04d3d3c7609e9c8e0 /src/python-systemd/pyutil.c
parent1070f974f7a1b6ba012e352b9d635d3902eca244 (diff)
systemd-python: add support for sd_j_open_files
Also export missing flags.
Diffstat (limited to 'src/python-systemd/pyutil.c')
-rw-r--r--src/python-systemd/pyutil.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/python-systemd/pyutil.c b/src/python-systemd/pyutil.c
index 42e7ba72cf..722c4f5b5f 100644
--- a/src/python-systemd/pyutil.c
+++ b/src/python-systemd/pyutil.c
@@ -58,3 +58,23 @@ int set_error(int r, const char* path, const char* invalid_message) {
}
return -1;
}
+
+#if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1
+int Unicode_FSConverter(PyObject* obj, void *_result) {
+ PyObject **result = _result;
+
+ assert(result);
+
+ if (!obj)
+ /* cleanup: we don't return Py_CLEANUP_SUPPORTED, so
+ * we can assume that it was PyUnicode_FSConverter. */
+ return PyUnicode_FSConverter(obj, result);
+
+ if (obj == Py_None) {
+ *result = NULL;
+ return 1;
+ }
+
+ return PyUnicode_FSConverter(obj, result);
+}
+#endif