]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-152219: Add curses window attribute get/set methods and WA_* constants (GH-152221)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 26 Jun 2026 04:48:53 +0000 (07:48 +0300)
committerGitHub <noreply@github.com>
Fri, 26 Jun 2026 04:48:53 +0000 (07:48 +0300)
commit285d96dd784620fe8afb02688abe72a916555061
treec0732376f6c6d94519d93441cc5b67e7b868ea32
parent794b42ff8a75614898c98c56ab87090e9804c369
gh-152219: Add curses window attribute get/set methods and WA_* constants (GH-152221)

Add the window methods attr_get(), attr_set(), attr_on(), attr_off() and
color_set(), wrapping wattr_get(), wattr_set(), wattr_on(), wattr_off() and
wcolor_set().  Unlike the legacy attron()/attroff()/attrset() methods, these
pass the color pair as a separate argument instead of packing it into the
attribute value.  Also add the corresponding WA_* attribute constants.

Add an attr_converter that range-checks the attr_t attribute argument and
raises OverflowError instead of silently truncating it; apply it to attr_set(),
attr_on(), attr_off() and chgat().

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Doc/library/curses.rst
Doc/whatsnew/3.16.rst
Lib/test/test_curses.py
Misc/NEWS.d/next/Library/2026-06-25-19-44-16.gh-issue-152219.ndj4Ib.rst [new file with mode: 0644]
Modules/_cursesmodule.c
Modules/clinic/_cursesmodule.c.h