summaryrefslogtreecommitdiff
blob: 67e94312f770b88215b17161ebc44ef09cf4dfd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# HG changeset patch
# User Ed Catmur <ed@catmur.co.uk>
# Date 1392340585 18000
# Node ID c8bb4edd63253b5b23006e8674c015c854075981
# Parent  eeb82d3d33b1720024ee7aef9bdfba87bb1b163d
Fix build of Finch against Python3.

Fixes #15969.

diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -1281,7 +1281,12 @@
 {
 	char *dir = g_path_get_dirname(path);
 	FILE *file = fopen(path, "r");
-	PyObject *pp = PySys_GetObject("path"), *dirobj = PyString_FromString(dir);
+	PyObject *pp = PySys_GetObject("path");
+#if PY_MAJOR_VERSION >= 3
+	PyObject *dirobj = PyUnicode_FromString(dir);
+#else
+	PyObject *dirobj = PyString_FromString(dir);
+#endif
 
 	PyList_Insert(pp, 0, dirobj);
 	Py_DECREF(dirobj);