Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int #87520

Closed
jugmac00 mannequin opened this issue Mar 1, 2021 · 5 comments
Closed

xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int #87520

jugmac00 mannequin opened this issue Mar 1, 2021 · 5 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir

Comments

@jugmac00
Copy link
Mannequin

jugmac00 mannequin commented Mar 1, 2021

BPO 43354
Nosy @pganssle, @corona10, @jugmac00, @miss-islington
PRs
  • bpo-43354: xmlrpc: Fix type documentation for Fault.faultCode #24707
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-05-05.06:33:20.083>
    created_at = <Date 2021-03-01.13:42:31.922>
    labels = ['3.7', '3.8', '3.9', '3.10', 'docs']
    title = 'xmlrpc.client: Fault.faultCode erroneously documented to be a string, should be int'
    updated_at = <Date 2021-05-05.06:33:20.082>
    user = 'https://github.com/jugmac00'

    bugs.python.org fields:

    activity = <Date 2021-05-05.06:33:20.082>
    actor = 'jugmac00'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-05-05.06:33:20.083>
    closer = 'jugmac00'
    components = ['Documentation']
    creation = <Date 2021-03-01.13:42:31.922>
    creator = 'jugmac00'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43354
    keywords = ['patch']
    message_count = 5.0
    messages = ['387866', '387873', '387927', '389570', '392976']
    nosy_count = 5.0
    nosy_names = ['docs@python', 'p-ganssle', 'corona10', 'jugmac00', 'miss-islington']
    pr_nums = ['24707']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43354'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    @jugmac00
    Copy link
    Mannequin Author

    jugmac00 mannequin commented Mar 1, 2021

    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

    self.assertEquals(newf, {'faultCode': 42, 'faultString': 'Test Fault'})

    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.
    python/typeshed#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!

    @jugmac00 jugmac00 mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Mar 1, 2021
    @jugmac00 jugmac00 mannequin assigned docspython Mar 1, 2021
    @jugmac00 jugmac00 mannequin added docs Documentation in the Doc dir 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Mar 1, 2021
    @jugmac00 jugmac00 mannequin assigned docspython Mar 1, 2021
    @jugmac00 jugmac00 mannequin added the docs Documentation in the Doc dir label Mar 1, 2021
    @pganssle
    Copy link
    Member

    pganssle commented Mar 1, 2021

    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.

    @jugmac00
    Copy link
    Mannequin Author

    jugmac00 mannequin commented Mar 2, 2021

    The approved typeshed PR:
    python/typeshed#5083

    @miss-islington
    Copy link
    Contributor

    New changeset 027b669 by Jürgen Gmach in branch 'master':
    bpo-43354: xmlrpc: Fix type documentation for Fault.faultCode (GH-24707)
    027b669

    @jugmac00
    Copy link
    Mannequin Author

    jugmac00 mannequin commented May 5, 2021

    This was merged already.

    I did not know I have to manually close the issue, but here we go!

    @jugmac00 jugmac00 mannequin closed this as completed May 5, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes docs Documentation in the Doc dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants