Repository navigation
Fix curses module compilation with ncurses6 #69906
Copy link
Copy link
Closed
Labels
3.7 (EOL)end of lifeend of lifebuildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dir
Description
| BPO | 25720 |
|---|---|
| Nosy | @Yhg1s, @mdickinson, @serhiy-storchaka, @ma8ma, @yan12125 |
| PRs | |
| Dependencies | |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2017-11-01.12:38:50.867>
created_at = <Date 2015-11-24.11:39:07.962>
labels = ['extension-modules', 'build', '3.7']
title = 'Fix curses module compilation with ncurses6'
updated_at = <Date 2017-11-01.12:38:50.865>
user = 'https://bugs.python.org/donmez'bugs.python.org fields:
activity = <Date 2017-11-01.12:38:50.865>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = True
closed_date = <Date 2017-11-01.12:38:50.867>
closer = 'serhiy.storchaka'
components = ['Extension Modules']
creation = <Date 2015-11-24.11:39:07.962>
creator = 'donmez'
dependencies = ['31891']
files = ['41148', '45002', '45037']
hgrepos = []
issue_num = 25720
keywords = ['patch']
message_count = 27.0
messages = ['255261', '258136', '258137', '258142', '261920', '261923', '278050', '278054', '278128', '278140', '278241', '278242', '278245', '278248', '278303', '278353', '278360', '278363', '287757', '294071', '296750', '305178', '305181', '305370', '305372', '305373', '305374']
nosy_count = 6.0
nosy_names = ['twouters', 'mark.dickinson', 'donmez', 'serhiy.storchaka', 'masamoto', 'yan12125']
pr_nums = ['1689', '4164', '4212', '4213']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue25720'
versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of lifeend of lifebuildThe build process and cross-buildThe build process and cross-buildextension-modulesC modules in the Modules dirC modules in the Modules dir
Activity
donmez commentedon Nov 24, 2015
ncurses6 turned on NCURSES_OPAQUE, so now you have to use some helper functions instead of accessing the structs directly. This _should_ be compatible with ncurses5 though I didn't test it.
Original patch is from openSUSE.
donmez commentedon Jan 13, 2016
Any patch review/comment ?
serhiy-storchaka commentedon Jan 13, 2016
configure.ac directly uses w->_flags in a check. It looks that this check always fails with ncurses6.
donmez commentedon Jan 13, 2016
Thats not an issue for ncurses because Include/py_curses.h does:
So it overrides WINDOW_HAS_FLAGS for ncurses case.
donmez commentedon Mar 17, 2016
ping?
serhiy-storchaka commentedon Mar 17, 2016
I suspect that the patch can break build with non-ncurses implementations or with old ncurses (when is_pad() was added?). Needed more direct feature check.
yan12125 commentedon Oct 4, 2016
is_pad is added in ncurses 5.7-20090906 [1]. At least Mac OS X still ships ancient ncurses 5.7-20081102 [2], so an check in configure.ac is necessary. I'm trying it out.
[1] http://invisible-island.net/ncurses/NEWS.html#t20090906
[2] http://opensource.apple.com//source/ncurses/ncurses-46/ncurses/NEWS
serhiy-storchaka commentedon Oct 4, 2016
Mark, do you have relation to this?
ma8ma commentedon Oct 5, 2016
I tried to build curses module on Cygwin (Vista x86) using bpo-25720 patch. And it has been succeeded.
When test_curses ran without skip condition, it was same result as msg278060 (bpo-28190).
I found out build success reasons for cases of applying patch:
bpo-25720 -- implementation of WINDOW is opaque (but WINDOW_HAS_FLAGS is defined at Include/py_curses.h:61 ). However, curses module build went well to cover the _flags field from source code by is_pad.
bpo-14598 -- implementation of WINDOW is not opaque (WINDOWS_HAS_FLAGS is defined at configure script). Therefore, curses module build went well because WINDOW has the _flags field.
bpo-28190 -- implementation of WINDOW is opaque (WINDOW_HAS_FLAGS isn't defined: py_curses.h has been cleaned by patch). Hence, curses module build went well to remove the _flags field from source code at preprocessing.
All case tests on Cygwin have failed at unget_wch.
mdickinson commentedon Oct 5, 2016
Sorry, no. Whatever ncurses knowledge I may once have had has long since vanished.
ma8ma commentedon Oct 7, 2016
I updated the patch that add configuration check for is_pad. the is_pad is wrapped into py_is_pad at Modules/_cursesmodule.c:932 by either of three ways.
Case one -- is_pad is found: Define the macro that is simple wrapping.
Case two -- is_pad is not found, however WINDOW has _flags field: Define the macro using _flags field.
Case three -- is_pad is not found, and WINDOW doesn't have _flags field: Define the macro that is always preprocessed to FALSE.
I succeeded to build curses module on Cygwin (Vista x86) using this patch.
This patch doesn't include that undo fixes for specific platforms.
donmez commentedon Oct 7, 2016
@masamoto thank you!
6 remaining items
donmez commentedon Feb 14, 2017
What's the status on this? Can you please create a pull request on Github so we can continue there?
ma8ma commentedon May 21, 2017
Hi, I finished various things and tackle the issue again, I opened PR 1689 at last.
Changes from previous patch:
ma8ma commentedon Jun 24, 2017
Ping. I updated PR a bit: macOS is joined to new compile condition and remove platform-specific condition.
ma8ma commentedon Oct 29, 2017
I opened PR 4164 to improve the is_pad configure check and previous PR was closed.
serhiy-storchaka commentedon Oct 29, 2017
I'll try to test this on NetBSD after fixing curses on NetBSD. It uses a different implementation of curses which don't support is_pad.
serhiy-storchaka commentedon Nov 1, 2017
New changeset 8bc7d63 by Serhiy Storchaka (Masayuki Yamamoto) in branch 'master':
bpo-25720: Fix the method for checking pad state of curses WINDOW (bpo-4164)
8bc7d63
serhiy-storchaka commentedon Nov 1, 2017
New changeset ff6ae4d by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
bpo-25720: Fix the method for checking pad state of curses WINDOW (GH-4164) (bpo-4212)
ff6ae4d
serhiy-storchaka commentedon Nov 1, 2017
New changeset 6ba0b58 by Serhiy Storchaka (Miss Islington (bot)) in branch '2.7':
bpo-25720: Fix the method for checking pad state of curses WINDOW (GH-4164) (bpo-4213)
6ba0b58
serhiy-storchaka commentedon Nov 1, 2017
Thank you for your contribution Masayuki!
Install ncurses from Homebrew, if available
Install ncurses from Homebrew, if available
Install ncurses from Homebrew, if available (#2813)
Squashed commit of the following: