Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore ncurses widechar support on macOS #111460

Closed
sorcio opened this issue Oct 29, 2023 · 11 comments
Closed

Restore ncurses widechar support on macOS #111460

sorcio opened this issue Oct 29, 2023 · 11 comments
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error

Comments

@sorcio
Copy link
Contributor

sorcio commented Oct 29, 2023

Bug report

Bug description:

Python 3.12 dropped ncurses wide char support on macOS, so for example curses.get_wch() is not available anymore.

I believe this was an unintended consequence of #94452, because the change is not documented anywhere. After that PR, HAVE_NCURSESW is never defined on Darwin. It looks like this bit of logic was not ported from setup.py to configure.ac:

cpython/setup.py

Lines 1121 to 1124 in ec5e253

elif MACOS and curses_library == 'ncurses':
# Building with the system-suppied combined libncurses/libpanel
curses_defines.append(('HAVE_NCURSESW', '1'))
curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))

In fact, wide char support is always available when using Apple-provided ncurses, and it used to work correctly in the 3.11 builds that I tested.

@tiran can you confirm that this was unintended?

cc @sobolevn who interpreted this as an intended change in python/typeshed#10808.

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

macOS

Linked PRs

@sorcio sorcio added the type-bug An unexpected behavior, bug, or error label Oct 29, 2023
@ned-deily ned-deily added OS-mac build The build process and cross-build labels Oct 29, 2023
@ned-deily
Copy link
Member

@erlend-aasland

@erlend-aasland
Copy link
Contributor

Yes, this is probably an unintended side effect. I can look into it tomorrow.

(cc. @corona10, if you are interested)

@corona10
Copy link
Member

Yeah I will take a look too

@sorcio
Copy link
Contributor Author

sorcio commented Oct 30, 2023

Would it be interesting to encode some platform expectations in tests?

This regression went under the radar because test_unget_wch is skipped with @requires_curses_func('unget_wch'), among other reasons. Skipping makes sense in general. But in some build configurations (including macOS CI, macOS buildbots, and the official macOS installer) we know that we are building with ncurses, and unget_wch should exist.

Since this functionality is documented to be generally available, should a test assert that it actually is?

@sorcio
Copy link
Contributor Author

sorcio commented Nov 9, 2023

Maybe it was a one-character fix after all: #111878

(Note: if you are testing curses on macOS <14, you might need #111258 or a similar fix)

Should some test be added?

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 13, 2023
…111878)

(cherry picked from commit d2f305d)

Co-authored-by: Davide Rizzo <sorcio@gmail.com>
corona10 pushed a commit that referenced this issue Nov 14, 2023
… (gh-112034)

gh-111460: Restore ncurses widechar support on macOS (GH-111878)
(cherry picked from commit d2f305d)

Co-authored-by: Davide Rizzo <sorcio@gmail.com>
@erlend-aasland
Copy link
Contributor

Can this be closed?

@sorcio
Copy link
Contributor Author

sorcio commented Nov 14, 2023

@erlend-aasland if there is no need to test this, we're done here.

@erlend-aasland
Copy link
Contributor

@erlend-aasland if there is no need to test this, we're done here.

There's always a need for accompanying tests.

@sorcio
Copy link
Contributor Author

sorcio commented Nov 19, 2023

I need help with this then. What is a test supposed to test? We could say that wide char support should always be there on Darwin, but it could fail on builds that bring their own curses (or not).

@ronaldoussoren
Copy link
Contributor

@erlend-aasland : What kind of tests do you want to see here? AFAIK we generally don't test if expected platform features are present, other than some tests I've added when working on the Universal 2 port to ensure that weak linking works as expected.

@erlend-aasland
Copy link
Contributor

I did not have anything in particular in mind. If there is no particular need, let's just close this.

@erlend-aasland erlend-aasland added the pending The issue will be closed if no feedback is provided label Dec 5, 2023
@ronaldoussoren ronaldoussoren removed the pending The issue will be closed if no feedback is provided label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

5 participants