Skip to content

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

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

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

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

Backport of GH-154703 to 3.15.

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 11:13
… 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>
@read-the-docs-community

Copy link
Copy Markdown

@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 26, 2026
@serhiy-storchaka
serhiy-storchaka merged commit 5be0125 into python:3.15 Jul 26, 2026
61 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 5be012561c7e36acd634a7abf726b52d54a4e408 3.14

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 5be012561c7e36acd634a7abf726b52d54a4e408 3.13

@serhiy-storchaka serhiy-storchaka removed their assignment Jul 26, 2026
@serhiy-storchaka serhiy-storchaka removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 26, 2026
@serhiy-storchaka
serhiy-storchaka deleted the backport-154703-3.15 branch July 26, 2026 12:04
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