Skip to content

Argument Clinic generates different code on 32-bit and 64-bit platforms #155218

Description

@serhiy-storchaka

Bug report

Argument Clinic emits the flags of the optional groups in the iteration order of a set of group identifiers:

group_ids = {p.group for p in subset}  # eliminate duplicates

The identifiers of the groups before the required parameters are small negative integers, and hash(-1) == hash(-2) == -2. The order of colliding keys in a set depends on the probe sequence, and therefore on the size of Py_hash_t, so a 32-bit build generates

            group_left_2 = 1;
            group_left_1 = 1;

where a 64-bit build generates the same two lines in the opposite order.

This affects Modules/clinic/_cursesmodule.c.h in the current tree: addch(), addstr(), addnstr() and 6 other functions have a group before and a group after the required parameters, so regenerating them on a 32-bit platform produces a spurious diff.

The order of these assignments is arbitrary, they can be emitted in the order of the parameters.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestopic-argument-clinictype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions