diff options
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 8fcb5b465..43347218a 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -152,7 +152,12 @@ weechat_python_exec (struct t_plugin_script *script, if (rc == NULL) rc = PyInt_FromLong (0); - if (PyString_Check (rc) && (ret_type == WEECHAT_SCRIPT_EXEC_STRING)) + if (PyErr_Occurred()) + { + PyErr_Print (); + Py_XDECREF(rc); + } + else if (PyString_Check (rc) && (ret_type == WEECHAT_SCRIPT_EXEC_STRING)) { if (PyString_AsString (rc)) ret_value = strdup (PyString_AsString(rc)); @@ -191,9 +196,6 @@ weechat_python_exec (struct t_plugin_script *script, return NULL; } - if (PyErr_Occurred ()) - PyErr_Print (); - /* PyEval_ReleaseThread (python_current_script->interpreter); */ return ret_value; |