summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python/weechat-python.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scripts/python/weechat-python.c')
-rw-r--r--src/plugins/scripts/python/weechat-python.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 55e1be01e..e16618612 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -41,6 +41,7 @@ int python_quiet;
struct t_plugin_script *python_scripts = NULL;
struct t_plugin_script *last_python_script = NULL;
struct t_plugin_script *python_current_script = NULL;
+struct t_plugin_script *python_registered_script = NULL;
const char *python_current_script_filename = NULL;
PyThreadState *python_mainThreadState = NULL;
@@ -228,8 +229,7 @@ weechat_python_exec (struct t_plugin_script *script,
/* PyEval_ReleaseThread (python_current_script->interpreter); */
- if (old_python_current_script)
- python_current_script = old_python_current_script;
+ python_current_script = old_python_current_script;
if (old_interpreter)
PyThreadState_Swap (old_interpreter);
@@ -335,6 +335,7 @@ weechat_python_load (const char *filename)
}
python_current_script = NULL;
+ python_registered_script = NULL;
/* PyEval_AcquireLock (); */
python_current_interpreter = Py_NewInterpreter ();
@@ -492,7 +493,7 @@ weechat_python_load (const char *filename)
fclose (fp);
- if (python_current_script == NULL)
+ if (!python_registered_script)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"register\" not "
@@ -506,6 +507,7 @@ weechat_python_load (const char *filename)
return 0;
}
+ python_current_script = python_registered_script;
python_current_script->interpreter = (PyThreadState *) python_current_interpreter;
/* PyEval_ReleaseThread (python_current_script->interpreter); */