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
failure of test_colors_funcs in test_curses with ncurses 6.1 #80811
Comments
ncurses version: 6.1 $ ./python -m test -u curses test_curses
Run tests sequentially
0:00:00 load avg: 0.55 [1/1] test_curses
test test_curses failed -- Traceback (most recent call last):
File "/path/to/Lib/test/test_curses.py", line 285, in test_colors_funcs
curses.pair_content(curses.COLOR_PAIRS - 1)
OverflowError: signed short integer is greater than maximum test_curses failed == Tests result: FAILURE == Not sure if the following is relevant. In /usr/include/ncurses.h: NCURSES_WRAPPED_VAR(int, COLOR_PAIRS);
...
#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())
...
extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; ncurses 6.1 release notes [1] says:
|
I asked on bug-ncurses mailing list and Thomas Dickey suggests "improving the python curses binding to handle the newer terminal descriptions". Looks like that requires non-trivial efforts. On the other hand, I've also found a workaround: $ TERM=xterm python -m test -u curses -v test_curses (or anything without -256color suffix for $TERM) How about setting TERM=xterm in tests and documenting that CPython does not support new terminal descriptions for now? [1] http://lists.gnu.org/archive/html/bug-ncurses/2019-04/msg00003.html |
The test fails because curses.pair_content(curses.COLOR_PAIRS-1) validates its parameter against the limits for signed short (max 32767) while curses.COLOR_PAIRS-1 has the value 65535. Unfortunately, re-plumbing curses.pair_content() to use signed integers instead of signed shorts and replacing the underlying ncurses API call from pair_content() to extended_pair_content() doesn't fix the problem because extended_pair_content() still fails when passed 65535. Tracing into the ncurses 6.1 source code, I found that start_color() clamps the maximum number of color pairs at SHRT_MAX (32767) regardless of the number of color pairs supported by the terminal. |
I posted a bug report to the bug-ncurses mailing list: https://lists.gnu.org/archive/html/bug-ncurses/2019-05/msg00022.html |
I created issue bpo-36982 to track the extended color changes since they broader than this issue. |
I believe this is now just a duplicate of bpo-36982. If there is anything not already covered there, let's discuss it there. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: