Skip to content

[3.15] gh-153864: Fix curses window.insch() for non-ASCII characters on a wide build (GH-153865)#154117

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-3.15-curses-insch
Jul 19, 2026
Merged

[3.15] gh-153864: Fix curses window.insch() for non-ASCII characters on a wide build (GH-153865)#154117
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-3.15-curses-insch

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

Manual backport of #153865.

3.15 predates the 3.16 complexchar refactor, so the fix adds a wide-character path to 3.15's simpler insch() using its existing addch() idiom (setcchar(..., PAIR_NUMBER(...), NULL) + wins_wch/mvwins_wch).

Verified on a wide (HAVE_NCURSESW) build: test_curses passes, including test_output_character under ISO-8859-15 where (0xA4) exercises the fix.

…n a wide build (pythonGH-153865)

On a wide build, winsch() does not locale-decode a byte above 127, unlike
waddch(), so insch() inserted '¤' (U+00A4) instead of '€' for byte 0xA4
under ISO-8859-15.  Decode the byte with btowc() and insert it as a wide
character, like addch().

(cherry picked from commit 223cbff)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@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 46d7aa9fbd2fafb099da6a61f3865620d4dc9125 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 46d7aa9fbd2fafb099da6a61f3865620d4dc9125 3.13

@serhiy-storchaka serhiy-storchaka removed needs backport to 3.14 bugs and security fixes needs backport to 3.13 bugs and security fixes labels Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant