This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author julienc
Recipients julienc
Date 2016-05-27.22:17:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I tried to execute the following code, but `xmlrpclib` is raising an exception:

    >>> import xmlrpclib
    >>> data = """<?xml version="1.0"?> 
    ... <methodCall>
    ...     <methodName>test_method</methodName>
    ...     <params>
    ...         <param>
    ...             <value>
    ...                 <int/>
    ...             </value>
    ...         </param>
    ...     </params>
    ... </methodCall>"""
    >>> xmlrpclib.loads(data)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib64/python2.7/", line 1141, in loads
      File "/usr/lib64/python2.7/", line 558, in feed
        self._parser.Parse(data, 0)
      File "/usr/lib64/python2.7/", line 829, in end
        return f(self, join(self._data, ""))
      File "/usr/lib64/python2.7/", line 864, in end_int
    ValueError: invalid literal for int() with base 10: ''

The behaviour is the same with `<int></int>`, and in python 3.4 with xmlrpc.client .
However, I tried to parse the same data with PHP, and it works without any trouble.

    php > $data = '<?xml version="1.0"?><methodCall><methodName>test_method</methodName><params><param><value><int/></value></param></params></methodCall>';
    php > print_r(xmlrpc_decode($data));
        [0] => 0

The .NET documentation of XML-RPC also suggests that `<int/>` is interpreted as 0 (although I couldn't try it myself):
> If an XML-RPC struct member is missing its corresponding .NET struct member will be set to null instead of the default value for the type if a non-nullable type had been used, for example null instead of zero for an integer.

Is it a feature in .NET and PHP implementations of XML-RPC, or a bug in the python implementation? I didn't find any documentation about the XML-RPC protocol itself on this topic.
Date User Action Args
2016-05-27 22:17:42juliencsetrecipients: + julienc
2016-05-27 22:17:42juliencsetmessageid: <>
2016-05-27 22:17:42julienclinkissue27142 messages
2016-05-27 22:17:41julienccreate