classification
Title: xmlrpclib doesn't support 64bit integer replies
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, schmir, shrike
Priority: normal Keywords: patch

Created on 2008-05-27 19:26 by shrike, last changed 2008-05-30 12:21 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
xmlrpclib-64bitsupport.diff shrike, 2008-05-27 19:36 Patch to add support for 64 bit integers
Messages (8)
msg67426 - (view) Author: Riku Lindblad (shrike) Date: 2008-05-27 19:26
When querying a XML-RPC server that returns a 64 bit integer, the python
interface always returns an empty tuple.

When running with verbose=True the response is still intact, the library
just can't parse the result between the <i8></i8> tags.

Example response:
body: '<?xml version="1.0"
encoding="UTF-8"?>\r\n<methodResponse>\r\n<params>\r\n<param><value><i8>1157</i8></value></param>\r\n</params>\r\n</methodResponse>\r\n'
msg67427 - (view) Author: Riku Lindblad (shrike) Date: 2008-05-27 19:36
I attached a patch that seems to fix the problem, needs proper testing
though.
msg67461 - (view) Author: Ralf Schmitt (schmir) Date: 2008-05-28 18:57
which implementations do support those 64 bit integers?
msg67462 - (view) Author: Riku Lindblad (shrike) Date: 2008-05-28 19:02
I ran into 64bit integer responses with rtorrent's XML-RPC API.
msg67476 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-29 07:45
Thanks, fixed in r63782.
msg67483 - (view) Author: Ralf Schmitt (schmir) Date: 2008-05-29 08:14
I think it's also a bug that xmlrpclib just ignores unknown tags
(without even printing a warning).

and: wouldn't it be nice if we could also write back those integers?

>>> import xmlrpclib
>>> xmlrpclib.dumps((2**40,))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ralf/pydev/trunk/Lib/xmlrpclib.py", line 1126, in dumps
data = m.dumps(params)
  File "/home/ralf/pydev/trunk/Lib/xmlrpclib.py", line 671, in dumps
dump(v, write)
  File "/home/ralf/pydev/trunk/Lib/xmlrpclib.py", line 693, in __dump
f(self, value, write)
  File "/home/ralf/pydev/trunk/Lib/xmlrpclib.py", line 704, in dump_int
raise OverflowError, "int exceeds XML-RPC limits"
OverflowError: int exceeds XML-RPC limits

I asked about the implementations supporting this as this i8 tag does
not conform to the xmlrpc spec (but I would be happy if there was an de
facto standard for sending large integers and would also help implement it).
msg67485 - (view) Author: Riku Lindblad (shrike) Date: 2008-05-29 08:50
The I8 tag is an extension by xmlrpc-c:
http://xmlrpc-c.sourceforge.net/doc/libxmlrpc.html#extensiontype
(XMLRPC_TYPE_I8)
msg67531 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-30 12:21
As long as long integers aren't in the official spec, the current status
is fine - liberal in accepting, and strict in sending.
History
Date User Action Args
2008-05-30 12:21:36georg.brandlsetmessages: + msg67531
2008-05-29 08:50:31shrikesetmessages: + msg67485
2008-05-29 08:14:25schmirsetmessages: + msg67483
2008-05-29 07:45:36georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg67476
nosy: + georg.brandl
2008-05-28 19:02:40shrikesetmessages: + msg67462
2008-05-28 18:57:42schmirsetnosy: + schmir
messages: + msg67461
2008-05-27 19:36:23shrikesetfiles: + xmlrpclib-64bitsupport.diff
keywords: + patch
messages: + msg67427
2008-05-27 19:26:49shrikecreate