diff --git a/dbus_next/glib/proxy_object.py b/dbus_next/glib/proxy_object.py index b5887ba..ee0600b 100644 --- a/dbus_next/glib/proxy_object.py +++ b/dbus_next/glib/proxy_object.py @@ -133,7 +133,14 @@ def call_notify(msg, err): except DBusError as e: err = e - callback(msg.body, err) + if not out_len: + body = None + elif out_len == 1: + body = msg.body[0] + else: + body = msg.body + + callback(body, err) self.bus.call( Message(destination=self.bus_name, @@ -162,12 +169,7 @@ def callback(body, err): if call_error: raise call_error - if not out_len: - return None - elif out_len == 1: - return call_body[0] - else: - return call_body + return call_body method_name = f'call_{BaseProxyInterface._to_snake_case(intr_method.name)}' method_name_sync = f'{method_name}_sync'