New submission from Peter J. Farley III <pjfarl...@gmail.com>:
curses.pair_number() result under Windows (console or Terminal window) value must be shifted by 16 bits to be valid to use as input to the curses.pair_content() function. If the pair number result is not shifted, the call to curses.pair_content() fails with an overflow error: Traceback (most recent call last): File "C:\Users\MyUser\test\curses-color.py", line 126, in <module> curses.wrapper(main) File "C:\Python38\lib\curses\__init__.py", line 105, in wrapper return func(stdscr, *args, **kwds) File "C:\Users\MyUser\test\curses-color.py", line 72, in main fg, bg = curses.pair_content (pair) OverflowError: signed short integer is greater than maximum The attached curses program demonstrates the correct functioning using the pair value shift under Windows. Comment out the "if" and shift lines to reproduce the overflow error. Environment information: Windows 10 (latest updates) Windows cmd.exe window or Windows Terminal Version: 1.6.10571.0 Python 3.8.7 windows-curses 2.2.0 Also tested in: Ubuntu 20.04 (WSL2) ncurses6/focal,now 6.2-0ubuntu2 amd64 ---------- components: Extension Modules files: curses-color-1.py messages: 390137 nosy: pjfarleyiii priority: normal severity: normal status: open title: curses.pair_number() function incorrect value under Windows versions: Python 3.8 Added file: https://bugs.python.org/file49931/curses-color-1.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43716> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com