The Wayback Machine - https://web.archive.org/web/20250524220320/https://github.com/python/cpython/issues/123090
Skip to content

PyArg_ParseTuple incorrectly parses the input with "ip" (int, bool), but does process correctly "ii" (int, int) #123090

Closed as not planned
@ajalexei

Description

@ajalexei

Bug report

Bug description:

PyArg_ParseTuple seems to handle incorrectly if an integer/integers and a boolean/bool are passed as arguments to parse, e.g. for the format string "ip" or "iip", etc. It then produces the incorrect value for the first integer argument. In my code I get zero value for that first integer argument, and correct values for the the rest of the arguments. The issue seem to disappear if the qualifier for the boolean argument "p" is replaced with the integer one "i". The issue is also not there for the "Op" format string, e.g. when a Python object and a boolean are passed as arguments.

To illustrate the issue I created an example module that reproduces the bug. (The code is a bit too long to place it here directly, since it has to be a C extension)

CPython versions tested on:

3.12

Operating systems tested on:

Linux, macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions