[New-bugs-announce] [issue43354] xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int

Jürgen Gmach report at bugs.python.org
Mon Mar 1 08:42:31 EST 2021


New submission from Jürgen Gmach <juergen.gmach at googlemail.com>:

I created a XMLRPC API (via Zope), which gets consumed by a C# application.

C#'s XMLRPC lib expects an `int` for the `faultCode` but I currently return a string, as this is the type which is currently documented in the official docs
https://docs.python.org/3/library/xmlrpc.client.html#xmlrpc.client.Fault.faultCode

This leads to a `TypeMismatch` error on the client's side.


The documentation for `faultCode` is pretty much unchanged since 2007, when `xmlrpc.client.rst` was first created (at least at that place) by Georg Brandl. The docs are most probably older, but I do not know where they were managed before.

I had a look at the cpython source code, and at least the tests all use ints for `faultCode` (both of them :-) )

eg https://github.com/python/cpython/blob/255f53bdb54a64b93035374ca4484ba0cc1b41e1/Lib/test/test_xmlrpc.py#L166

Having a look at the XMLRPC spec at http://xmlrpc.com/spec.md it is clearly shown that `faultCode` has to be an int.

Typeshed recently added type hints for xmlrpc lib, and they used string for `faultCode` - but I guess this is just an aftereffect from the faulty documentation.
https://github.com/python/typeshed/pull/3834

I suggest to both update cpython's documentation and to create a PR for typeshed in order to fix the type issue.

If any core dev agrees on this, I'd like to prepare the pull requests.

Thanks for taking your time to look into this!

----------
assignee: docs at python
components: Documentation
messages: 387866
nosy: docs at python, jugmac00
priority: normal
severity: normal
status: open
title: xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43354>
_______________________________________


More information about the New-bugs-announce mailing list