Skip to content

gh-154070: Build the curses module wide by capability, not by name#154071

Open
serhiy-storchaka wants to merge 5 commits into
python:mainfrom
serhiy-storchaka:curses-wide-by-capability
Open

gh-154070: Build the curses module wide by capability, not by name#154071
serhiy-storchaka wants to merge 5 commits into
python:mainfrom
serhiy-storchaka:curses-wide-by-capability

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

configure chose wide vs narrow (HAVE_NCURSESW) by the pkg-config namencursesw wide, ncurses narrow — but wide support is a property of the library, not its name. A widec-built ncurses that keeps the plain libncurses/ncurses.pc name (pkgsrc on NetBSD/illumos, macOS system ncurses) was built narrow, losing the wide API and limiting addch()/getch()/inch() to ASCII in UTF-8 locales.

This runs the existing wide-API probe (setcchar()/add_wch(), added for the native curses backend in gh-136687) for the ncurses/auto backends too, defining HAVE_NCURSESW by capability. On macOS, where the locale is UTF-8, this turns a nearly unusable narrow build into a wide one.

Validated: Linux ncursesw stays wide and narrow ncurses/curses stay narrow; OpenIndiana and NetBSD pkgsrc ncurses go narrow → wide (NetBSD test_curses 162 run / 1 skip SUCCESS). macOS cannot be tested locally — the buildbots will.

configure built the module wide (HAVE_NCURSESW) only for a backend named
ncursesw.  Probe for the wide API in the ncurses and auto backends too, so
a widec-built ncurses keeping the plain name (pkgsrc, macOS) is built wide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
serhiy-storchaka and others added 3 commits July 22, 2026 20:13
…r build

The wide-character probe ran inside a nested WITH_SAVE_ENV, whose single
CPPFLAGS save slot is not reentrant, so the outer restore leaked
$CURSES_CFLAGS and $PANEL_CFLAGS (-D_XOPEN_SOURCE=600) into
CONFIGURE_CPPFLAGS and thus into every translation unit, producing a
'_XOPEN_SOURCE' redefined warning against pyconfig.h on every file.

Save and restore CPPFLAGS with a dedicated variable around the probe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

!buildbot "ARM64 MacOS M1 NoGIL"
!buildbot "x86-64 macOS"
!buildbot "AMD64 Debian root"

@bedevere-bot

Copy link
Copy Markdown

The regex '"ARM64 MacOS M1 NoGIL"' did not match any buildbot builder. Is the requested builder in the list of stable builders?

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

!buildbot ARM64 MacOS M1 NoGIL
!buildbot x86-64 macOS
!buildbot AMD64 Debian root

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 9d58138 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F154071%2Fmerge

The command will test the builders whose names match following regular expression: ARM64 MacOS M1 NoGIL

The builders matched are:

  • ARM64 MacOS M1 NoGIL PR

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

!buildbot x86-64 macOS

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 9d58138 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F154071%2Fmerge

The command will test the builders whose names match following regular expression: x86-64 macOS

The builders matched are:

  • x86-64 MacOS Intel NoGIL PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • x86-64 macOS PR

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

!buildbot AMD64 Debian root

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 9d58138 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F154071%2Fmerge

The command will test the builders whose names match following regular expression: AMD64 Debian root

The builders matched are:

  • AMD64 Debian root PR

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

!buildbot x86-64 macOS PR

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 9d58138 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F154071%2Fmerge

The command will test the builders whose names match following regular expression: x86-64 macOS PR

The builders matched are:

  • x86-64 macOS PR

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.

3 participants