Skip to content

Conversation

@ma8ma
Copy link
Contributor

@ma8ma ma8ma commented May 21, 2017

Highlights of change

  • Add configure check for whether have is_pad function/macro.
  • Define py_is_pad macro if HAVE_CURSES_IS_PAD or WINDOW_HAS_FLAGS are defined.
  • Change conditional compilation: replace WINDOW_HAS_FLAGS with py_is_pad
  • Remove the code that defines always WINDOW_HAS_FLAGS when having ncurses.h.
  • Set WINDOW to non-opaque type if both HAVE_CURSES_IS_PAD and WINDOW_HAS_FLAGS aren't defined when having ncurses.h.

Motivation

WINDOW_HAS_FLAGS will be defined by the configure check, but if the platform has ncurses.h, defines the macro always. Therefore, codes that check directly the field of WINDOW are enabled regardless of NCURSES_OPAQUE (since ncurses 5.7), and a platform that WINDOW is actually opaque occurs compile error at that place.
For this reason, the codes are modified to use py_is_pad macro to check WINDOW state. Note that if ncurses doesn't have both is_pad function (since 5.8) and _flags field of WINDOW, there is no method to check whether WINDOW is a pad. In this case, NCURSES_OPAQUE is defined as zero to make WINDOW to non-opaque type before including ncurses.h.

https://bugs.python.org/issue25720

WINDOW_HAS_FLAGS will be defined by the configure check, but if the
platform has ncurses.h, defines the macro always.  Therefore, codes
that check directly the field of WINDOW are enabled regardless of
NCURSES_OPAQUE (since ncurses 5.7), and a platform that WINDOW is
actually opaque occurs compile error at that place.
For this reason, the codes are modified to use py_is_pad macro to check
WINDOW state.  Note that if ncurses doesn't have both is_pad function
(since 5.8) and _flags field of WINDOW, there is no method to check
whether WINDOW is a pad.  In this case, NCURSES_OPAQUE is defined as
zero to make WINDOW to non-opaque type before including ncurses.h.
@ma8ma
Copy link
Contributor Author

ma8ma commented Oct 29, 2017

Close this PR because I rewrote #4164 to improve the is_pad configure check.

@ma8ma ma8ma closed this Oct 29, 2017
@ma8ma ma8ma deleted the bpo-25720-curses-is_pad branch November 1, 2017 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants