summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/plugins/python/weechat-python.c10
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 45adb271b..5cdc3af97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* irc: add server option "default_msg_kick" to customize default kick/kickban
message (task #12777)
* lua: fix crash on calls to callbacks during load of script
+* python: fix load of scripts with python >= 3.3
== Version 0.4.2 (2013-10-06)
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index e74f9be0a..aeff3802c 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -659,7 +659,13 @@ weechat_python_load (const char *filename)
if (str_home)
{
snprintf (str_home, len, "%s/python", weechat_home);
+#if PY_MAJOR_VERSION >= 3
+ /* python >= 3.x */
+ path = PyUnicode_FromString(str_home);
+#else
+ /* python <= 2.x */
path = PyBytes_FromString (str_home);
+#endif
if (path != NULL)
{
PyList_Insert (python_path, 0, path);
@@ -670,10 +676,10 @@ weechat_python_load (const char *filename)
}
#if PY_MAJOR_VERSION >= 3
- /* python 3.x (or newer) */
+ /* python >= 3.x */
weechat_outputs = PyModule_Create (&moduleDefOutputs);
#else
- /* python 2.x */
+ /* python <= 2.x */
weechat_outputs = Py_InitModule("weechatOutputs",
weechat_python_output_funcs);
#endif