diff -ru dbus-python.orig/dbus/_expat_introspect_parser.py dbus-python/dbus/_expat_introspect_parser.py --- dbus-python.orig/dbus/_expat_introspect_parser.py 2011-03-02 10:59:21.000000000 +0800 +++ dbus-python/dbus/_expat_introspect_parser.py 2011-03-02 13:59:21.000000000 +0800 @@ -58,7 +58,10 @@ if (not self.in_method and name == 'interface'): self.in_iface = '' elif (self.in_method and name == 'method'): - self.map[self.in_iface + '.' + self.in_method] = self.sig + key = self.in_iface + '.' + self.in_method + if key not in self.map: + self.map[key] = [] + self.map[key].append(self.sig) self.in_method = '' self.sig = '' @@ -67,12 +70,15 @@ concatenation of all their 'in' parameters, and mapping ``interface.signal`` strings to the concatenation of all their parameters. + Keys are mapped to lists to handle the case of overloaded method + and signal names. Example output:: { - 'com.example.SignalEmitter.OneString': 's', - 'com.example.MethodImplementor.OneInt32Argument': 'i', + 'com.example.SignalEmitter.OneString': ['s'], + 'com.example.MethodImplementor.OneInt32Argument': ['i'], + 'com.example.MethodImplementor.Overloaded': ['s', 'i'], } :Parameters: diff -ru dbus-python.orig/dbus/connection.py dbus-python/dbus/connection.py --- dbus-python.orig/dbus/connection.py 2011-03-02 10:59:21.000000000 +0800 +++ dbus-python/dbus/connection.py 2011-03-02 11:58:00.000000000 +0800 @@ -557,19 +557,33 @@ get_args_opts = {'utf8_strings': utf8_strings, 'byte_arrays': byte_arrays} - message = MethodCallMessage(destination=bus_name, - path=object_path, - interface=dbus_interface, - method=method) - # Add the arguments to the function - try: - message.append(signature=signature, *args) - except Exception, e: + if type(signature) is not list: + signature = [signature] + + message = None + exception = None + for sig in signature: + this_message = MethodCallMessage(destination=bus_name, + path=object_path, + interface=dbus_interface, + method=method) + # Add the arguments to the function + try: + this_message.append(signature=sig, *args) + except Exception, e: + exception = e + else: + if message is not None: + raise DBusException('Ambiguous call on overloaded method ' + '%s' % method) + message = this_message + + if message is None: logging.basicConfig() _logger.error('Unable to set arguments %r according to ' 'signature %r: %s: %s', args, signature, e.__class__, e) - raise + raise exception if reply_handler is None and error_handler is None: # we don't care what happens, so just send it @@ -611,19 +625,33 @@ get_args_opts = {'utf8_strings': utf8_strings, 'byte_arrays': byte_arrays} - message = MethodCallMessage(destination=bus_name, - path=object_path, - interface=dbus_interface, - method=method) - # Add the arguments to the function - try: - message.append(signature=signature, *args) - except Exception, e: + if type(signature) is not list: + signature = [signature] + + message = None + exception = None + for sig in signature: + this_message = MethodCallMessage(destination=bus_name, + path=object_path, + interface=dbus_interface, + method=method) + # Add the arguments to the function + try: + this_message.append(signature=sig, *args) + except Exception, e: + exception = e + else: + if message is not None: + raise DBusException('Ambiguous call on overloaded method ' + '%s' % method) + message = this_message + + if message is None: logging.basicConfig() _logger.error('Unable to set arguments %r according to ' 'signature %r: %s: %s', args, signature, e.__class__, e) - raise + raise exception # make a blocking call reply_message = self.send_message_with_reply_and_block(