From 02fc4053c903a2d4b671f1b85b05f90a4d891612 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 28 Nov 2013 19:46:36 +0100 Subject: python: fix load of scripts with python >= 3.3 --- src/plugins/python/weechat-python.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins/python') 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 -- cgit v1.2.3