summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/python
diff options
context:
space:
mode:
authorEmmanuel Bouthenot <kolter@openics.org>2006-05-08 20:22:42 +0000
committerEmmanuel Bouthenot <kolter@openics.org>2006-05-08 20:22:42 +0000
commit5d08d5e27c1d2430ba25f6903d47d7acb422f144 (patch)
tree4271f8ddf6e123645c61e390d3f013aca7b6cc13 /src/plugins/scripts/python
parent93e69f5b3efec9ddc9198e7bb4d5f06af19bad28 (diff)
downloadweechat-5d08d5e27c1d2430ba25f6903d47d7acb422f144.zip
- fix a crash in ruby when a function return nothing (close bug #16552)
- add a warning when a function return nothing (python, ruby)
Diffstat (limited to 'src/plugins/scripts/python')
-rw-r--r--src/plugins/scripts/python/weechat-python.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 4e50072a7..8f024fde4 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -91,14 +91,20 @@ weechat_python_exec (t_weechat_plugin *plugin,
else
rc = PyObject_CallFunction (evFunc, "");
+
+ if (rc == Py_None)
+ {
+ python_plugin->print_server (python_plugin, "Python error: function \"%s\" must return a valid value", function);
+ return PLUGIN_RC_OK;
+ }
+
if (rc)
{
ret = (int) PyInt_AsLong(rc);
Py_XDECREF(rc);
}
- if (PyErr_Occurred ())
- PyErr_Print ();
+ if (PyErr_Occurred ()) PyErr_Print ();
if (ret < 0)
return PLUGIN_RC_OK;