GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-151757: Support wide and combining characters in the curses module by serhiy-storchaka · Pull Request #151758 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jun 19, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The character-cell window methods now accept a full character cell -- a spacing character optionally followed by combining characters (up to CCHARW_MAX wide characters) -- in addition to a single int or byte character. This affects addch(), bkgd(), bkgdset(), border(), box(), echochar(), hline(), insch() and vline(), which dispatch to the ncursesw wide-character functions (wadd_wch(), wbkgrnd(), wborder_set(), wecho_wchar(), whline_set(), wins_wch(), wvline_set(), ...) when given a string. border() and box() cannot mix integer or byte characters with wide-string characters in a single call.

A cell is one spacing character optionally followed by combining characters, so an extra spacing or control character (for example "ab", an emoji ZWJ sequence, or an emoji with a skin-tone modifier) is rejected with ValueError rather than being silently truncated by setcchar(). A single control character is still accepted (curses applies its usual control processing, e.g. backspace, tab and carriage return).

Also added are the wide-character read methods window.get_wstr() and window.in_wstr(), the counterparts of window.getstr() and window.instr() that return a str rather than bytes, and the module functions curses.erasewchar(), curses.killwchar() and curses.wunctrl(), the wide-character counterparts of curses.erasechar(), curses.killchar() and curses.unctrl().

All of this is available only when built against the wide-character ncursesw library.

🤖 Generated with Claude Code

  • Issue: Add wide-character (cchar_t) support to the curses module #151757

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka @claude
pythongh-151757: Support wide and combining characters in the curses …
6cb20f7
…module

The character-cell window methods now accept a full character cell -- a
spacing character optionally followed by combining characters (up to
CCHARW_MAX wide characters) -- in addition to a single int or byte
character.  This affects addch(), bkgd(), bkgdset(), border(), box(),
echochar(), hline(), insch() and vline(); they dispatch to the ncursesw
wide-character functions (wadd_wch(), wbkgrnd(), wborder_set(),
wecho_wchar(), whline_set(), wins_wch(), wvline_set(), ...) when given a
string.  border() and box() cannot mix integer or byte characters with
wide string characters in a single call.  A cell is one spacing character
optionally followed by combining characters, so an extra spacing or
control character (such as "ab") is rejected with ValueError rather than
being silently truncated by setcchar().

Also add the wide-character read methods get_wstr() and in_wstr(), the
counterparts of getstr() and instr() that return a str rather than a
bytes object, and the module functions erasewchar(), killwchar() and
wunctrl(), the wide-character counterparts of erasechar(), killchar()
and unctrl().

All of this is available only when built against the wide-character
ncursesw library.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@serhiy-storchaka
serhiy-storchaka requested a review from AA-Turner as a code owner June 19, 2026 23:17
@bedevere-app bedevere-app Bot mentioned this pull request Jun 19, 2026
Add wide-character (cchar_t) support to the curses module #151757
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 19, 2026
@read-the-docs-community

read-the-docs-community Bot commented Jun 19, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33224239 | 📁 Comparing 6cb20f7 against main (66cc048)

  🔍 Preview build  

3 files changed
± library/curses.html
± whatsnew/3.16.html
± whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka merged commit a5677bf into python:main Jun 24, 2026
100 of 102 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Jun 24, 2026
@serhiy-storchaka
serhiy-storchaka deleted the curses-widechar branch June 24, 2026 05:52
@fedonman fedonman mentioned this pull request Aug 10, 2026
curses border() and box() no longer accept 0 with a str #155499
Closed
@Lohitha0-0 Lohitha0-0 mentioned this pull request Aug 10, 2026
gh-155499: Fix curses border() and box() rejecting 0 mixed with str/bytes #155521
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@serhiy-storchaka
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.