Skip to content

gh-153395: Accept curses.complexchar in curses.ascii predicates and conversions#153396

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:curses-ascii-complexchar
Open

gh-153395: Accept curses.complexchar in curses.ascii predicates and conversions#153396
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:curses-ascii-complexchar

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

The curses.ascii predicates and the ctrl() and unctrl() functions now accept a curses.complexchar (the character-cell type added in gh-151757), classifying it by its single character. A complexchar that holds combining characters is not a single character and so matches no class.

ctrl() now returns a non-ASCII argument unchanged instead of masking it to a control character. There is no control character outside ASCII, and for many keys ctrl() on the real terminal is already a no-op (1, ', .) or emits irreproducible codes (KEY_BACKSPACE, KEY_RESIZE), so masking a non-ASCII code to a control character was meaningless.

ascii(), alt() and ismeta() are left unchanged: they remain meaningful only for 8-bit codes, as they already were for most non-ASCII characters.

… and conversions

The curses.ascii predicates and the ctrl() and unctrl() functions now accept
a curses.complexchar, classifying it by its single character.  ctrl() now
returns a non-ASCII argument unchanged instead of masking it to a control
character.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33509404 | 📁 Comparing 25feef4 against main (f3fd9dc)

  🔍 Preview build  

2 files changed
± library/curses.ascii.html
± whatsnew/changelog.html

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