summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);