64-bit values in XML RPC: OverflowError: int exceeds XML-RPC limits
Hello, when I'm trying to use 64-bit integer values with SimpleXMLRPCServer, I'm getting "OverflowError: int exceeds XML-RPC limits" error each time I use an integer with value greater or equal to 2^31. I googled this: http://bugs.python.org/issue2985 So, my question is: In which Python release has been this fix distributed? Thank you in advance for information. Btw, I've made some dummy scripts to demonstrate the issue: - server.py: from SimpleXMLRPCServer import SimpleXMLRPCServer def dummy(number): return number server = SimpleXMLRPCServer(("localhost", 8000)) server.register_function(dummy, 'dummy') server.serve_forever() - client.py import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8000/") print proxy.dummy(0x7FFFFFFF) print proxy.dummy(0x80000000) The output from client is: localhost.localdomain - - [15/Jul/2009 15:24:12] "POST / HTTP/1.0" 200 - 2147483647 Traceback (most recent call last): File "./client.py", line 7, in <module> print proxy.dummy(0x80000000) File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.6/xmlrpclib.py", line 1483, in __request allow_none=self.__allow_none) File "/usr/lib64/python2.6/xmlrpclib.py", line 1132, in dumps data = m.dumps(params) File "/usr/lib64/python2.6/xmlrpclib.py", line 677, in dumps dump(v, write) File "/usr/lib64/python2.6/xmlrpclib.py", line 699, in __dump f(self, value, write) File "/usr/lib64/python2.6/xmlrpclib.py", line 710, in dump_int raise OverflowError, "int exceeds XML-RPC limits" OverflowError: int exceeds XML-RPC limits Have a nice day. Peter p.s.: I'm not subscribed to the list, se please keep me in CC when replying. Thank you. -- Peter Hanecak ePC Developer | Alcatel-Lucent Apollo BC II - B block | Prievozska 4/A 11 | Bratislava | Slovak Republic email: peter.hanecak@alcatel-lucent.com phone: +421 (0)2 49264 857
On Wed, 15 Jul 2009 at 09:29, Benjamin Peterson wrote:
2009/7/15 Peter Hanecak <peter.hanecak@alcatel-lucent.sk>:
So, my question is: In which Python release has been this fix distributed?
Python 2.6 and above.
But it doesn't solve your problem, since the ticket says it only fixes reading long ints, not writing them. --David
Hello, thank you David and Benjamin for quick response. So my subsequent question is: What can help me solve the "writing" part? Sincerely Peter On 07/15/2009 04:39 PM, R. David Murray wrote:
On Wed, 15 Jul 2009 at 09:29, Benjamin Peterson wrote:
2009/7/15 Peter Hanecak <peter.hanecak@alcatel-lucent.sk>:
So, my question is: In which Python release has been this fix distributed?
Python 2.6 and above.
But it doesn't solve your problem, since the ticket says it only fixes reading long ints, not writing them.
--David
-- Peter Hanecak ePC Developer | Alcatel-Lucent Apollo BC II - B block | Prievozska 4/A 11 | Bratislava | Slovak Republic email: peter.hanecak@alcatel-lucent.com phone: +421 (0)2 49264 857
On Wed, Jul 15, 2009 at 4:42 PM, Peter Hanecak<peter.hanecak@alcatel-lucent.sk> wrote:
Hello,
thank you David and Benjamin for quick response.
So my subsequent question is: What can help me solve the "writing" part?
Use strings. Send str(0x7FFFFFFF) from the client for example , and get back your number on server side with a long(number) call. That's what I do.
On Wed, Jul 15, 2009 at 16:42, Peter Hanecak<peter.hanecak@alcatel-lucent.sk> wrote:
So my subsequent question is: What can help me solve the "writing" part?
The XML-RPC protocol, as specified at [1], doesn't support integers with more than 32 bits (in fact, the i4 alias can be used to make the use of 4 bytes explicit). So, either don't use XML-RPC, or encode it in some other type (e.g. a string or base64). Cheers, Dirkjan [1] http://www.xmlrpc.com/spec
participants (5)
-
Benjamin Peterson
-
Dirkjan Ochtman
-
Peter Hanecak
-
R. David Murray
-
Tarek Ziadé