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

bpo-25720: Fix the method for checking pad state of curses WINDOW #4164

Merged
merged 5 commits into from
Nov 1, 2017

Conversation

ma8ma
Copy link
Contributor

@ma8ma ma8ma commented Oct 29, 2017

Highlights of changes

  • Modify configure check for the WINDOW _flags field.
  • Add configure check for is_pad function/macro.
  • Remove the definition of NCURSES_OPAQUE for Apple-specific.
  • Define NCURSES_OPAQUE as zero in the case of no is_pad() and having WINDOW _flags.
  • Modify the requirement for defining WINDOW_HAS_FLAGS when having ncurses.h.
  • Add requirement for defining HAVE_CURSES_IS_PAD when having ncurses.h.
  • 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.

Motivation

WINDOW_HAS_FLAGS will be defined by configure check, but if your platform has ncurses.h, defines the macro always. Therefore, codes which check the WINDOW _flags field are enabled regardless of NCURSES_OPAQUE (added since ncurses 5.7), and a compile error occurs on platforms where WINDOW is actually opaque.

For this reason, these codes are modified to use ncurses is_pad() instead of checking the field. If your platform does not provide the is_pad() (added since ncurses 5.8 as a ncurses-specific feature), the existing way that checks the field will be enabled. In this case, NCURSES_OPAQUE is defined as zero before including [n]curses.h, for exposing WINDOW fields regardless of the configuraton.

Note: This change does not drop support for platforms where do not have both WINDOW _flags field and is_pad().

https://bugs.python.org/issue25720

ma8ma added 3 commits October 29, 2017 17:50
Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configure check doesn't work. The testing code is compiled successfully since implicit declaration of functions is not an error in C. This results to false detection of the is_pad function and compilation failure on NetBSD.

Look at recently added checks for other curses functions/macros.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ma8ma
Copy link
Contributor Author

ma8ma commented Oct 31, 2017

@serhiy-storchaka I see 👍
I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@serhiy-storchaka: please review the changes made to this pull request.

@serhiy-storchaka serhiy-storchaka added needs backport to 2.7 type-bug An unexpected behavior, bug, or error labels Nov 1, 2017
@serhiy-storchaka serhiy-storchaka merged commit 8bc7d63 into python:master Nov 1, 2017
@miss-islington
Copy link
Contributor

Thanks @ma8ma for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 1, 2017
…thonGH-4164)

Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
(cherry picked from commit 8bc7d63)
@bedevere-bot
Copy link

GH-4212 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 1, 2017
…thonGH-4164)

Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
(cherry picked from commit 8bc7d63)
@bedevere-bot
Copy link

GH-4213 is a backport of this pull request to the 2.7 branch.

serhiy-storchaka pushed a commit that referenced this pull request Nov 1, 2017
…-4164) (#4212)

Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
(cherry picked from commit 8bc7d63)
serhiy-storchaka pushed a commit that referenced this pull request Nov 1, 2017
…-4164) (#4213)

Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
(cherry picked from commit 8bc7d63)
@ma8ma
Copy link
Contributor Author

ma8ma commented Nov 1, 2017

@serhiy-storchaka Thank you for merging!

@ma8ma ma8ma deleted the bpo-25720-patch-2 branch November 1, 2017 18:00
embray pushed a commit to embray/cpython that referenced this pull request Nov 9, 2017
…thon#4164)

Modify the code to use ncurses is_pad() instead of checking WINDOW
_flags field.  If your platform does not provide the is_pad(), the
existing way that checks the field will be enabled.

Note: This change does not drop support for platforms where do not
have both WINDOW _flags field and is_pad().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants