qulogic/libgnt
Clone
Summary
Browse
Changes
Graph
Fix call to Py_SetProgramName in Python3.
release-2.x.y
2014-02-13, Elliott Sales de Andrade
c37afb64c6ad
Parents
2e4ab66cdbcf
Children
d73aa438daf8
5eb75f6413f5
Fix call to Py_SetProgramName in Python3.
Refs #15969.
1 files changed, 10 insertions(+), 0 deletions(-)
+10
-0
gntwm.c
--- a/gntwm.c Thu Feb 13 20:16:25 2014 -0500
+++ b/gntwm.c Thu Feb 13 20:33:18 2014 -0500
@@ -1577,7 +1577,17 @@
gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "run-python", run_python,
GNT_KEY_F3, NULL);
if (!Py_IsInitialized()) {
+#if PY_MAJOR_VERSION >= 3
+ wchar_t *name;
+ size_t len;
+ len = mbstowcs(NULL, "gnt", 0);
+ name = g_new(wchar_t, len + 1);
+ mbstowcs(name, "gnt", len + 1);
+ Py_SetProgramName(name);
+ g_free(name);
+#else
Py_SetProgramName("gnt");
+#endif
Py_Initialize();
started_python = TRUE;
}