bpo-25720: curses: Fix check for whether WINDOW is a pad #1689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Highlights of change
is_padfunction/macro.py_is_padmacro ifHAVE_CURSES_IS_PADorWINDOW_HAS_FLAGSare defined.WINDOW_HAS_FLAGSwithpy_is_padWINDOW_HAS_FLAGSwhen having ncurses.h.WINDOWto non-opaque type if bothHAVE_CURSES_IS_PADandWINDOW_HAS_FLAGSaren't defined when having ncurses.h.Motivation
WINDOW_HAS_FLAGSwill be defined by the configure check, but if the platform has ncurses.h, defines the macro always. Therefore, codes that check directly the field ofWINDOWare enabled regardless ofNCURSES_OPAQUE(since ncurses 5.7), and a platform thatWINDOWis actually opaque occurs compile error at that place.For this reason, the codes are modified to use
py_is_padmacro to checkWINDOWstate. Note that if ncurses doesn't have bothis_padfunction (since 5.8) and_flagsfield ofWINDOW, there is no method to check whetherWINDOWis a pad. In this case,NCURSES_OPAQUEis defined as zero to makeWINDOWto non-opaque type before including ncurses.h.https://bugs.python.org/issue25720