[issue7977] I found Python 3.1 xmlrpc lib use "<param>" not properly. and i have fixed it.
Jelly Chen
report at bugs.python.org
Sat Mar 20 13:10:32 CET 2010
Jelly Chen <sinojelly at gmail.com> added the comment:
I know why those two tests run failed, and I found another way to solve the
problem, do not make the existing tests broken, and at the same time I have
added another test case.
I encountered this problem due to a argument is already being a tuple but
re-packaged into another tuple, It appears a high probability. Maybe modify
the client.py according to this patch is a solution.
2010/2/22 Florent Xicluna <report at bugs.python.org>
>
> Florent Xicluna <laxyf at yahoo.fr> added the comment:
>
> Attached, the output of the test with "-v test_xmlrpc".
>
> ----------
> Added file: http://bugs.python.org/file16308/issue7977_test_xmlrpc.log
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue7977>
> _______________________________________
>
----------
Added file: http://bugs.python.org/file16597/unnamed
Added file: http://bugs.python.org/file16598/dir.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7977>
_______________________________________
-------------- next part --------------
<div><span class="Apple-style-span" style="font-family: Arial, sans-serif; font-size: 13px; line-height: 22px; "><span title="æç¥é为ä»ä¹é£ä¸¤ä¸ªç¨ä¾è¿è¡å¤±è´¥äºï¼å¹¶ä¸ææ¾å°äºå¦å¤ä¸ä¸ªåæ³å»è§£å³é®é¢ï¼ä¸ä¼ä½¿å¾å·²æçç¨ä¾è¿è¡ä¸è¿ï¼åæ¶æè¡¥å
äºä¸ä¸ªç¨ä¾ã">I know why those two tests run failed, and I found another way to solve the problem, do not make the existing tests broken, and at the same time I have added another test case.<br>
</span><span title="æéå°çé®é¢ï¼æ¯ç±äºå·²ç»æ¯ä¸ä¸ªtupleçåæ°ï¼è¢«å次å°è£
æä¸ä¸ªtupleã">I encountered this problem due to a argument is already being a tuple but re-packaged into another tuple, It appears a high probability. Maybe modify the client.py according to this patch is a solution.</span></span><br>
<br><div class="gmail_quote">2010/2/22 Florent Xicluna <span dir="ltr"><<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Florent Xicluna <<a href="mailto:laxyf at yahoo.fr">laxyf at yahoo.fr</a>> added the comment:<br>
<br>
Attached, the output of the test with "-v test_xmlrpc".<br>
<br>
----------<br>
Added file: <a href="http://bugs.python.org/file16308/issue7977_test_xmlrpc.log" target="_blank">http://bugs.python.org/file16308/issue7977_test_xmlrpc.log</a><br>
<div><div></div><div class="h5"><br>
_______________________________________<br>
Python tracker <<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>><br>
<<a href="http://bugs.python.org/issue7977" target="_blank">http://bugs.python.org/issue7977</a>><br>
_______________________________________<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Contact me: <br>QQ: 2578717<br>MSN: <a href="mailto:sinojelly at msn.cn">sinojelly at msn.cn</a><br>æ°æµªå¾®åï¼<a href="http://t.sina.com.cn/sinojelly">http://t.sina.com.cn/sinojelly</a><br>
æçå客ï¼<a href="http://sinojelly.20x.cc">http://sinojelly.20x.cc</a><br><br><br>
</div>
-------------- next part --------------
diff -Nur old\test\test_xmlrpc.py new\test\test_xmlrpc.py
--- old\test\test_xmlrpc.py Thu Aug 13 18:30:32 2009
+++ new\test\test_xmlrpc.py Sat Mar 20 19:39:48 2010
@@ -478,6 +478,14 @@
# This avoids waiting for the socket timeout.
self.test_simple1()
+ def test_call_with_tuple_param(self):
+ def execute(server, methodname, *args):
+ r = getattr(server, methodname)(args) # params become a tuple
+ return r
+ p = xmlrpclib.ServerProxy(URL)
+ r = execute(p, "add", 4,7)
+ self.assertEqual(r, 11)
+
# This is a contrived way to make a failure occur on the server side
# in order to test the _send_traceback_header flag on the server
class FailingMessageClass(http.client.HTTPMessage):
diff -Nur old\xmlrpc\client.py new\xmlrpc\client.py
--- old\xmlrpc\client.py Thu Jun 04 17:11:52 2009
+++ new\xmlrpc\client.py Sat Mar 20 19:41:03 2010
@@ -49,6 +49,7 @@
# 2003-07-12 gp Correct marshalling of Faults
# 2003-10-31 mvl Add multicall support
# 2004-08-20 mvl Bump minimum supported Python version to 2.1
+# 2010-03-20 cgd Avoid to make a tuple to be another tuple(Chenguodong email:sinojelly at gmail.com)
#
# Copyright (c) 1999-2002 by Secret Labs AB.
# Copyright (c) 1999-2002 by Fredrik Lundh.
@@ -1026,6 +1027,9 @@
def __getattr__(self, name):
return _Method(self.__send, "%s.%s" % (self.__name, name))
def __call__(self, *args):
+ # Fixed by sinojelly: if args[0] is a tuple, should not make it to be another tuple.
+ if len(args) == 1 and type(args[0]) is type(()):
+ args = args[0]
return self.__send(self.__name, args)
##
More information about the Python-bugs-list
mailing list