Skip to content

curses complexchar.attr carries the color pair and saturates at 255 #154840

Description

@fedonman

Bug description:

The docs say complexchar stores the color pair separately and without the
color_pair() limit, but on a wide build attr carries the packed pair and saturates
at 255:

>>> curses.complexchar("A", curses.A_BOLD, 1).attr == curses.A_BOLD
False
>>> hex(curses.complexchar("A", 0, 300).attr), curses.complexchar("A", 0, 300).pair
('0xff00', 300)
>>> hex(curses.complexchar("A", 0, 1000).attr)

curses_cell_attr_pair() returns getcchar()'s attrs, which include A_COLOR. Its
narrow branch already masks that out, as GH-154703 did for inch().

complexchar is new in 3.16, so no released version is affected.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions