From c6fdeaf7e57dd671260e4a9222d2334e7a25184e Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 7 May 2013 08:56:12 +0200 Subject: [PATCH] python: fix crash when loading scripts with Python 3.x (patch #8044) (thanks to isak) --- ChangeLog | 3 ++- src/plugins/python/weechat-python.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5becf9deb..08557d872 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.4.1-rc1, 2013-05-06 +v0.4.1-rc1, 2013-05-07 This document lists all changes for each version. @@ -90,6 +90,7 @@ Version 0.4.1 (under dev!) * lua: fix crash on stack overflow: call lua_pop() for values returned by lua functions (bug #38510) * perl: simplify code to load scripts +* python: fix crash when loading scripts with Python 3.x (patch #8044) * relay: rename compression "gzip" to "zlib" (compression is zlib, not gzip) * relay: add message "_nicklist_diff" (differences between old and current nicklist) diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index 7c8c09cb0..becd762ab 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -618,7 +618,7 @@ weechat_python_load (const char *filename) python_current_interpreter = Py_NewInterpreter (); #if PY_MAJOR_VERSION >= 3 /* python >= 3.x */ - len = strlen (argv[0]); + len = mbstowcs (NULL, argv[0], 0) + 1; wargv[0] = malloc ((len + 1) * sizeof (wargv[0][0])); if (wargv[0]) {