summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-11-28 19:46:36 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-11-28 19:46:36 +0100
commit02fc4053c903a2d4b671f1b85b05f90a4d891612 (patch)
treee6a877daf01f8399674e7405d1928297eda719ca /src/plugins
parent74333b2270f768a3a7587a4cc51f03dbe522488a (diff)
downloadweechat-02fc4053c903a2d4b671f1b85b05f90a4d891612.zip
python: fix load of scripts with python >= 3.3
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/python/weechat-python.c10
1 files changed, 8 insertions, 2 deletions
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