From bdee58826a2d3490f62db4d3f3c6541dc8310698 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 28 Jun 2026 19:18:59 +0200 Subject: [PATCH] [3.14] gh-87881: Document the result of curses inch() and getbkgd() (GH-152488) (GH-152511) (GH-152514) Explain the character/attribute bit layout and how to extract the parts (A_CHARTEXT and A_ATTRIBUTES bit-masks, pair_number() for the color pair). (cherry picked from commit d831a690766e92b3be5e40134f64407bd041bcbf) (cherry picked from commit 09013312bbdf9ff6583c95ba6bc2698e61c66be6) Co-authored-by: Serhiy Storchaka Co-authored-by: Claude Opus 4.8 --- Doc/library/curses.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index 3d037ea7b455..b74dfa047107 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -978,6 +978,7 @@ Window objects .. method:: window.getbkgd() Return the given window's current background character/attribute pair. + Its components can be extracted like those of :meth:`inch`. .. method:: window.getch([y, x]) @@ -1068,8 +1069,10 @@ Window objects .. method:: window.inch([y, x]) - Return the character at the given position in the window. The bottom 8 bits are - the character proper, and upper bits are the attributes. + Return the character at the given position in the window. + The bottom 8 bits are the character proper and the upper bits are the attributes; + extract them with the :data:`A_CHARTEXT` and :data:`A_ATTRIBUTES` bit-masks, + and the color pair with :func:`pair_number`. .. method:: window.insch(ch[, attr]) -- 2.47.3