Skip to content

gh-152332: Add the curses.term_attrs() function#152333

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:curses-term-attrs
Jun 27, 2026
Merged

gh-152332: Add the curses.term_attrs() function#152333
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:curses-term-attrs

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Add the X/Open term_attrs() function, the attr_t counterpart of the already-exposed termattrs().

term_attrs() returns the logical OR of all video attributes supported by the terminal as :ref:WA_* <curses-wa-constants> values, where termattrs() returns the equivalent A_* values as a chtype.

It is implemented with PyLong_FromUnsignedLong() rather than the int-returning helper used by termattrs(), because attr_t is unsigned (and 64-bit on an lp64 ncurses build).

term_attrs() returns the video attributes supported by the terminal as
WA_* values, the counterpart of termattrs() for the A_* values.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jun 26, 2026

Copy link
Copy Markdown

@serhiy-storchaka serhiy-storchaka merged commit 0ed6711 into python:main Jun 27, 2026
54 checks passed
@serhiy-storchaka serhiy-storchaka deleted the curses-term-attrs branch June 27, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant