← 返回首页
xmlrpc.client.loads raises IndexError on a malformed struct · Issue #153803 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

xmlrpc.client.loads raises IndexError on a malformed struct #153803

New issue
New issue

Description

Bug description

xmlrpc.client.loads() raises a raw IndexError instead of xmlrpc.client.ResponseError when unmarshalling a <struct> that contains a <member> with a <name> but no <value>.

Unmarshaller.end_struct iterates the stacked items in pairs (items[i], items[i+1]). A <member> missing its <value> leaves an odd number of items, so items[i+1] raises IndexError.

The unmarshaller already raises ResponseError for sibling malformed cases (empty stack at line 640, unknown tag inside <data> at line 663).

Reproducer:

import xmlrpc.client data = (b'<?xml version="1.0"?>' b'<methodResponse><params><param><value>' b'<struct><member><name>k</name></member></struct>' b'</value></param></params></methodResponse>') xmlrpc.client.loads(data) # IndexError: list index out of range

Expected: xmlrpc.client.ResponseError.

CPython versions tested on

3.13, 3.14, 3.15, main

Operating systems tested on

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    • Open in GitHub Copilot app

    Footer

    © 2026 GitHub, Inc.