summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2008-07-14 16:09:27 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2008-07-14 16:09:27 +0100
commit1144c656fa9d956853fd8c03dc52937f60d3ee2e (patch)
treea8b26befa45d4dfc23b640ba961ef672a4bfd8cf
parent37fd41a721a5417eeb72e90cbe3296f823ccc1b2 (diff)
downloaddbus-python-1144c656fa9d956853fd8c03dc52937f60d3ee2e.tar.gz
DBusPyServer: if there's no main loop, throw an exception
The code starting at the "err" label assumes that an exception has been set already.
-rw-r--r--_dbus_bindings/server.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/_dbus_bindings/server.c b/_dbus_bindings/server.c
index 6af462f..3f32f43 100644
--- a/_dbus_bindings/server.c
+++ b/_dbus_bindings/server.c
@@ -232,8 +232,14 @@ DBusPyServer_NewConsumingDBusServer(PyTypeObject *cls,
/* Change mainloop from a borrowed reference to an owned reference */
if (!mainloop || mainloop == Py_None) {
mainloop = dbus_py_get_default_main_loop();
- if (!mainloop)
+
+ if (!mainloop || mainloop == Py_None) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "To run a D-Bus server, you need to either "
+ "pass mainloop=... to the constructor or cal "
+ "dbus.set_default_main_loop(...)");
goto err;
+ }
}
else {
Py_INCREF(mainloop);