[issue7977] I found Python 3.1 xmlrpc lib use "<param>" not properly. and i have fixed it.

Amaury Forgeot d'Arc report at bugs.python.org
Thu Jul 22 08:22:26 CEST 2010


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

But what if I want to pass a tuple through xmlrpc?
The function in the test case:
+        def execute(server, methodname, *args):
+            r = getattr(server, methodname)(args) # params become a tuple
+            return r
looks wrong to me. It has the effect to modify the nature of the arguments. 
If I write instead:
+        def execute(server, methodname, *args):
+            r = getattr(server, methodname)(*args)
+            return r
(note the additional '*') the function may receive several arguments, and will call the server method with several arguments as well.
Tuple unpacking occurs where tuple packing was made. The library does not need to be changed.

----------
nosy: +amaury.forgeotdarc
resolution:  -> invalid
status: open -> pending

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7977>
_______________________________________


More information about the Python-bugs-list mailing list