From 85495d4b9582de474209f739928323b12bb5ffe7 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 28 Mar 2009 22:06:10 +0100 Subject: [PATCH] Fix display of python errors --- src/plugins/scripts/python/weechat-python.c | 10 ++++++---- 1 file 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;