Title: xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int
Type: Stage: patch review
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: corona10, docs@python, jugmac00, miss-islington, p-ganssle
Priority: normal Keywords: patch

Created on 2021-03-01 13:42 by jugmac00, last changed 2021-03-26 21:09 by miss-islington.

Pull Requests
URL Status Linked Edit
PR 24707 merged jugmac00, 2021-03-02 12:53
Messages (4)
msg387866 - (view) Author: Jürgen Gmach (jugmac00) * Date: 2021-03-01 13:42
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

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 :-) )


Having a look at the XMLRPC spec at 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.

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!
msg387873 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2021-03-01 15:24
The evidence you have here seems pretty compelling and this change seems straightforward enough. I don't see an expert listed here, but I'm happy to merge a docs PR fixing this.

Probably a good idea to make a PR to typeshed in parallel, in case they have some further insight into this.
msg387927 - (view) Author: Jürgen Gmach (jugmac00) * Date: 2021-03-02 12:57
The approved typeshed PR:
msg389570 - (view) Author: miss-islington (miss-islington) Date: 2021-03-26 21:09
New changeset 027b6699276ed8d9f68425697ac89bf61e54e6b9 by Jürgen Gmach in branch 'master':
bpo-43354: xmlrpc: Fix type documentation for Fault.faultCode (GH-24707)
Date User Action Args
2021-03-26 21:09:17miss-islingtonsetnosy: + miss-islington
messages: + msg389570
2021-03-02 12:57:40jugmac00setmessages: + msg387927
2021-03-02 12:53:44jugmac00setkeywords: + patch
stage: patch review
pull_requests: + pull_request23482
2021-03-01 17:20:53corona10setnosy: + corona10
2021-03-01 15:24:56p-gansslesetnosy: + p-ganssle
messages: + msg387873
2021-03-01 13:42:31jugmac00create