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

color_content() fails above color 15 and pair_number() result needs shifting to use #20

Open
pjfarleyiii opened this issue Apr 11, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@pjfarleyiii
Copy link

pjfarleyiii commented Apr 11, 2021

I have found two issues with the current release of windows-curses:

  1. The color_content() function fails for any color number above 15, while in an *ix ncurses environment it returns values (although they are not correct values in my testing so far).
  2. The pair_number() function on Windows only returns a value that must be shifted right by 16 bits before it can be used as the argument to the pair_content() function. In an *ix ncurses environment the shift is not required.

For issue 2, if the shift is not done then the program crashes with these error messages at the call to pair_content().

Traceback (most recent call last):
File "C:\test\wincurses-issues.py", line 60, in
curses.wrapper(main)
File "C:\Python38\lib\curses_init_.py", line 105, in wrapper
return func(stdscr, *args, **kwds)
File "C:\test\wincurses-issues.py", line 49, in main
fg, bg = curses.pair_content (pair)
OverflowError: signed short integer is greater than maximum

Code to show the two problems is attached as a *.txt file. Rename to *.py to run the example. Comment out the test for windows and the pair shift to observe the crash.

Environments tested:
Win 10-64
Python 3.8.9 (tags/v3.8.9:a743f81, Apr 6 2021, 14:02:34) [MSC v.1928 64 bit (AMD64)]
windows-curses 2.2.0

Ubuntu 20.04 (Win 10 / WSL2)
libncurses6/focal,now 6.2-0ubuntu2 amd64

Peter

wincurses-issues.txt

@stephanosio stephanosio added the bug Something isn't working label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants