summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-03-01 09:12:02 +0100
committerSébastien Helleu <flashcode@flashtux.org>2015-03-01 09:12:02 +0100
commit79afeb2111f6d85f158a5daf825c65b6a03e0fc8 (patch)
tree9ed8aeadb00875131acd0cb84490d16e4cfc8fa8 /src
parent5a7059751635abacc0ede10fdedfa1d45c73143e (diff)
downloadweechat-79afeb2111f6d85f158a5daf825c65b6a03e0fc8.zip
python: fix restore of old interpreter when a function is not found in the script
Diffstat (limited to 'src')
-rw-r--r--src/plugins/python/weechat-python.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index 21fd90b7b..9f0b0019b 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -319,9 +319,12 @@ weechat_python_exec (struct t_plugin_script *script,
void *argv2[16], *ret_value;
int i, argc, *ret_int;
+ ret_value = NULL;
+
/* PyEval_AcquireLock (); */
old_python_current_script = python_current_script;
+ python_current_script = script;
old_interpreter = NULL;
if (script->interpreter)
{
@@ -339,13 +342,9 @@ weechat_python_exec (struct t_plugin_script *script,
weechat_gettext ("%s%s: unable to run function \"%s\""),
weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
/* PyEval_ReleaseThread (python_current_script->interpreter); */
- if (old_interpreter)
- PyThreadState_Swap (old_interpreter);
- return NULL;
+ goto end;
}
- python_current_script = script;
-
if (argv && argv[0])
{
argc = strlen (format);
@@ -368,8 +367,6 @@ weechat_python_exec (struct t_plugin_script *script,
rc = PyObject_CallFunction (evFunc, NULL);
}
- ret_value = NULL;
-
/*
* ugly hack : rc = NULL while 'return weechat.WEECHAT_RC_OK ....
* because of '#define WEECHAT_RC_OK 0'
@@ -428,6 +425,7 @@ weechat_python_exec (struct t_plugin_script *script,
/* PyEval_ReleaseThread (python_current_script->interpreter); */
+end:
python_current_script = old_python_current_script;
if (old_interpreter)