gh-133031: Support the full Unicode range in curses.textpad.Textbox#152482
Merged
serhiy-storchaka merged 1 commit intoJun 28, 2026
Conversation
…tbox Read input with get_wch() and the window back with in_wch(), so combining characters and characters outside the locale encoding now work where curses has wide-character support. edit() passes non-ASCII characters to validate() as strings, keeping ASCII and key codes as integers so existing validators keep working. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview
|
Member
|
Looks like this is failing on the ARM64 MacOS M1 NoGIL 3.x buildbot, for example: ======================================================================
ERROR: test_textbox_edit_wide (test.test_curses.TestCurses.test_textbox_edit_wide) (ch='é')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/buildbot/buildarea/3.x.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_curses.py", line 2354, in test_textbox_edit_wide
curses.unget_wch(c)
~~~~~~~~~~~~~~~~^^^
OverflowError: character does not fit in a single bytehttps://buildbot.python.org/#/builders/1270/builds/7928 And likely some of the other buildbot failures: https://buildbot.python.org/#/release_status |
Member
Author
|
Thanks. Should be fixed in #152592. |
Member
|
The failure is still there: https://buildbot.python.org/#/builders/1270/builds/7968 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #152451 (which fixed 8-bit non-ASCII handling).
curses.textpad.Textboxnow reads input withget_wch()and the window back within_wch(), so the full Unicode range -- including combining characters -- is entered and read back when curses is built with wide-character support.Because those methods are now available on every build, the widget uses a single code path: without wide-character support a cell holds a single byte, so there it stays limited to an 8-bit locale encoding.
edit()passes non-ASCII characters tovalidate()and the command dispatch as strings, keeping ASCII characters and key codes as integers so existing validators keep working.Verified on both wide (UTF-8) and narrow (ISO-8859-15, KOI8-U) builds.
🤖 Generated with Claude Code