1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-22 19:06:37 +02:00

display python trackback on errors

This commit is contained in:
Emmanuel Bouthenot
2005-11-22 20:47:53 +00:00
parent 80ed16c3c0
commit 163ded5658
2 changed files with 26 additions and 8 deletions
+13 -4
View File
@@ -68,19 +68,22 @@ weechat_python_exec (t_weechat_plugin *plugin,
function);
return PLUGIN_RC_KO;
}
ret = -1;
python_current_script = script;
rc = PyObject_CallFunction(evFunc, "ss", server == NULL ? "" : server, arguments == NULL ? "" : arguments);
if (rc)
{
ret = (int) PyInt_AsLong(rc);
Py_XDECREF(rc);
}
if (PyErr_Occurred ())
PyErr_Print ();
if (ret < 0)
return PLUGIN_RC_OK;
else
@@ -757,6 +760,9 @@ weechat_python_output (PyObject *self, PyObject *args)
return NULL;
}
while (strlen(msg) > 0 && msg[strlen(msg)-1] == '\n')
msg[strlen(msg)-1] = '\0';
python_plugin->printf_server (python_plugin,
"Python stdin/stdout: %s", msg);
return Py_BuildValue ("i", 1);
@@ -859,7 +865,10 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
weechat_script_remove (plugin, &python_scripts, python_current_script);
return 0;
}
if (PyErr_Occurred ())
PyErr_Print ();
fclose (fp);
free (python_current_script_filename);