Bug report
Since #152332 added curses.term_attrs(), _curses fails to import when built against the narrow ncurses library, for example with --with-curses=ncurses:
[ERROR] _curses failed to import: .../_curses.cpython-316d-x86_64-linux-gnu.so: undefined symbol: term_attrs
ncurses defines term_attrs() only in the wide library (libncursesw). However, configure detects curses functions with a compile-only check (PY_CHECK_CURSES_FUNC), so it only verifies that a header declares the function. The header used is often built with wide support (ncursesw/curses.h, or even /usr/include/curses.h on Debian when _XOPEN_SOURCE is defined), and it declares term_attrs(). So HAVE_CURSES_TERM_ATTRS gets defined while the module links with -lncurses.
PY_CHECK_CURSES_FUNC should be a link check, like the check for the wide character API.
Reported on Discourse: https://discuss.python.org/t/compiling-cpython-fails-without-wide-char-ncurses/109209
Linked PRs
Bug report
Since #152332 added
curses.term_attrs(),_cursesfails to import when built against the narrow ncurses library, for example with--with-curses=ncurses:ncurses defines
term_attrs()only in the wide library (libncursesw). However,configuredetects curses functions with a compile-only check (PY_CHECK_CURSES_FUNC), so it only verifies that a header declares the function. The header used is often built with wide support (ncursesw/curses.h, or even/usr/include/curses.hon Debian when_XOPEN_SOURCEis defined), and it declaresterm_attrs(). SoHAVE_CURSES_TERM_ATTRSgets defined while the module links with-lncurses.PY_CHECK_CURSES_FUNCshould be a link check, like the check for the wide character API.Reported on Discourse: https://discuss.python.org/t/compiling-cpython-fails-without-wide-char-ncurses/109209
Linked PRs