gh-153862: Fix spurious color pair in curses window.inch() on a wide build - #154703
Conversation
… wide build winch() returns the whole code point, so inch() replacing only its low 8 bits left the high bits in the color field. Rebuild from getcchar()'s attributes and color pair. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
On a wide build inch() derived its result from winch(), whose character is the whole code point rather than a locale byte, so a code point past 0xff overflowed into the color field and past 0xffff into the attribute bits. Read the cell with win_wch() and build the chtype from the locale byte plus the attributes and color pair reported by getcchar(). The character is 0 when it has no single-byte form; win_wch() and getcchar() failures now raise. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
GH-154720 is a backport of this pull request to the 3.15 branch. |
…a wide build (GH-154703) (GH-154720) winch() returns the whole code point, so inch() replacing only its low 8 bits left the high bits in the color field. Rebuild from getcchar()'s attributes and color pair. (cherry picked from commit b618874) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * gh-153862: Suggest instr() for non-encodable characters read by inch() A character that does not fit in a single byte has a character byte of 0 in the value returned by inch(); document reading such characters with instr(). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
|
GH-154732 is a backport of this pull request to the 3.14 branch. |
|
GH-154733 is a backport of this pull request to the 3.13 branch. |
…a wide build (GH-154703) (GH-154733) winch() returns the whole code point, so inch() replacing only its low 8 bits left the high bits in the color field. Rebuild from getcchar()'s attributes and color pair. (cherry picked from commit b618874) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…a wide build (GH-154703) (GH-154732) winch() returns the whole code point, so inch() replacing only its low 8 bits left the high bits in the color field. Rebuild from getcchar()'s attributes and color pair. (cherry picked from commit b618874) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… wide build (pythonGH-154703) winch() returns the whole code point, so inch() replacing only its low 8 bits left the high bits in the color field. Rebuild from getcchar()'s attributes and color pair. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
winch()returns the character's full code point, soinch()/mvinch()recovering the locale byte by replacing only its low 8 bits left a code point past0xffleaking into the color-pair field. Under ISO-8859-15,inch()of'€'returned0x20A4(the byte0xA4plus a spurious color pair 32) instead of0xA4.Rebuild the value from the attributes and color pair that
getcchar()reports separately.The test asserted only
inch() & A_CHARTEXT, masking the leaked bits; it now asserts the whole value.