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.

classification
Title: xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int
Type: Stage: resolved
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
process
Status: closed 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 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24707 merged jugmac00, 2021-03-02 12:53
Messages (5)
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
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!
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:
https://github.com/python/typeshed/pull/5083
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)
https://github.com/python/cpython/commit/027b6699276ed8d9f68425697ac89bf61e54e6b9
msg392976 - (view) Author: Jürgen Gmach (jugmac00) * Date: 2021-05-05 06:33
This was merged already.


I did not know I have to manually close the issue, but here we go!
History
Date User Action Args
2022-04-11 14:59:42adminsetgithub: 87520
2021-05-05 06:33:20jugmac00setstatus: open -> closed

messages: + msg392976
stage: patch review -> resolved
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