mirror of
https://github.com/weechat/weechat.git
synced 2026-06-24 11:56:38 +02:00
python: fix restore of old interpreter when a function is not found in the script
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user