Skip to content

Restore ncurses widechar support on macOS #111460

Description

@sorcio

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Oct 29, 2023
  2. ned-deily commented on Oct 29, 2023

    @ned-deily
    Member
  3. erlend-aasland commented on Oct 29, 2023

    @erlend-aasland
    Contributor

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

    (cc. @corona10, if you are interested)

  4. corona10 commented on Oct 29, 2023

    @corona10
    Member

    Yeah I will take a look too

  5. sorcio commented on Oct 30, 2023

    @sorcio
    ContributorAuthor

    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?

  6. added a commit that references this issue on Nov 9, 2023
  7. sorcio commented on Nov 9, 2023

    @sorcio
    ContributorAuthor

    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?

  8. added a commit that references this issue on Nov 13, 2023
  9. added a commit that references this issue on Nov 13, 2023
  10. added a commit that references this issue on Nov 14, 2023
  11. erlend-aasland commented on Nov 14, 2023

    @erlend-aasland
    Contributor

    Can this be closed?

  12. sorcio commented on Nov 14, 2023

    @sorcio
    ContributorAuthor

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

  13. erlend-aasland commented on Nov 14, 2023

    @erlend-aasland
    Contributor

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

    There's always a need for accompanying tests.

  14. sorcio commented on Nov 19, 2023

    @sorcio
    ContributorAuthor

    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).

  15. ronaldoussoren commented on Dec 5, 2023

    @ronaldoussoren
    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.

  16. erlend-aasland commented on Dec 5, 2023

    @erlend-aasland
    Contributor

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

  17. added
    pendingThe issue will be closed if no feedback is provided
    on Dec 5, 2023
  18. removed
    pendingThe issue will be closed if no feedback is provided
    on Dec 5, 2023
  19. added a commit that references this issue on Feb 11, 2024
  20. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions