FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-152233: Make the curses cell API work without ncursesw by serhiy-storchaka · Pull Request #152466 · python/cpython · GitHub

Repository navigation

gh-152233: Make the curses cell API work without ncursesw - #152466

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:curses-narrow-cells
Jun 28, 2026
Merged

serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:curses-narrow-cells

Conversation

Copy link
Copy Markdown
Member

Make complexchar, complexstr and the cell read methods in_wch, in_wchstr, in_wstr and getbkgrnd work whether or not Python was built against a wide-character (ncursesw) library, so the same code runs on both builds.

When ncursesw is absent a cell is backed by a chtype instead of a cchar_t: it holds a single character, encodable as one byte in the window's encoding (so only 8-bit locales are supported), with the color pair limited to the color_pair() range. get_wch, get_wstr, erasewchar, killwchar and wunctrl stay wide-only (they have no narrow counterpart with the same return type).

Tested on both a wide (-lncursesw) and a narrow (-lncurses) build of test_curses under en_US.UTF-8, en_US.ISO-8859-15 and uk_UA.KOI8-U.

Back complexchar, complexstr and the cell read methods (in_wch,
in_wchstr, in_wstr, getbkgrnd) with a chtype instead of a cchar_t when
ncursesw is absent, so the same code works on both builds.  A narrow
build is limited to one character per cell, encodable as a single byte in
the window's encoding (8-bit locales), with the color pair limited to the
color_pair() range.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33341197 | 📁 Comparing 4dd24a5 against main (46d1809)

  🔍 Preview build  

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

serhiy-storchaka enabled auto-merge (squash) June 28, 2026 05:08
serhiy-storchaka merged commit 95bfaff into python:main Jun 28, 2026
55 of 56 checks passed
serhiy-storchaka deleted the curses-narrow-cells branch July 1, 2026 16:47
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL