Skip to content

ctypes: Remove misleading comment about tuple support in _as_parameter_ and add regression test #142174

Description

@CodeMaverick-143

Bug report

Bug description:

Modules/_ctypes/callproc.c contained a comment (marked XXX) stating that as_parameter
allows constructing arbitrary tuples and passing them, describing this convention as "dangerous".
Analysis confirms that
ctypes
does not support returning tuples from as_parameter for default conversions. Attempting to do so raises a "TypeError" (wrapped in an ArgumentError), meaning the described security risk does not exist in the current codebase.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Activity

  1. added
    docsDocumentation in the Doc dir
    type-refactorCode refactoring (with no changes in behavior)
    and removed
    type-bugAn unexpected behavior, bug, or error
    on Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions