/pidgin/main: 922e7abddb4d: Fix call to Py_SetProgramName in Pyt...

Elliott Sales de Andrade qulogic at pidgin.im
Thu Feb 13 20:33:57 EST 2014


Changeset: 922e7abddb4dbc1a397aad9c1d3b6fd091c4e392
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2014-02-13 20:33 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/922e7abddb4d

Description:

Fix call to Py_SetProgramName in Python3.

Refs #15969.

diffstat:

 finch/libgnt/gntwm.c |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (21 lines):

diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -1577,7 +1577,17 @@ gnt_wm_class_init(GntWMClass *klass)
 	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;
 	}



More information about the Commits mailing list