Skip to content

[3.13] gh-153862: Fix spurious color pair in curses window.inch() on a wide build (GH-154703)#154733

Merged
serhiy-storchaka merged 2 commits into
python:3.13from
serhiy-storchaka:backport-154703-3.13
Jul 26, 2026
Merged

[3.13] gh-153862: Fix spurious color pair in curses window.inch() on a wide build (GH-154703)#154733
serhiy-storchaka merged 2 commits into
python:3.13from
serhiy-storchaka:backport-154703-3.13

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 26, 2026

Copy link
Copy Markdown
Member

Backport of GH-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.

Also documents that on a wide-character build inch() returns 0 for a character that does not fit in a single byte, and suggests instr() to read such characters.

serhiy-storchaka and others added 2 commits July 26, 2026 14:25
… 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.

(cherry picked from commit b618874)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… 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) <noreply@anthropic.com>
@serhiy-storchaka
serhiy-storchaka merged commit d283a86 into python:3.13 Jul 26, 2026
44 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the backport-154703-3.13 branch July 26, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant