serhiy-storchaka · GitHub

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

Read the original on github.com ↗