Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7d3616

Browse files
committed
Patch from Randall Hopper to fix PR #116172, "curses module fails to
build on SGI": * Check for 'sgi' preprocessor symbol, not '__sgi__' * Surround individual character macros with #ifdef's, instead of making them all rely on STRICT_SYSV_CURSES
1 parent 19647ca commit e7d3616

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,15 @@ char *PyCursesVersion = "1.6";
7878
#include <curses.h>
7979
#endif
8080

81-
#if defined(__sgi__) || defined(__sun__)
81+
#ifdef sgi
82+
/* This prototype is in <term.h>, but including this header #defines
83+
many common symbols (such as "lines") which breaks the curses
84+
module in other ways. So the code will just specify an explicit
85+
prototype here. */
86+
extern char *tigetstr(char *);
87+
#endif
88+
89+
#if defined(sgi) || defined(__sun__)
8290
#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
8391
typedef chtype attr_t; /* No attr_t type is available */
8492
#endif
@@ -1739,13 +1747,27 @@ PyCurses_InitScr(PyObject *self, PyObject *args)
17391747
SetDictInt("ACS_BSBS", (ACS_HLINE));
17401748
SetDictInt("ACS_SBSB", (ACS_VLINE));
17411749
SetDictInt("ACS_SSSS", (ACS_PLUS));
1742-
#ifndef STRICT_SYSV_CURSES
1743-
/* The following are never available with strict SYSV curses */
1750+
1751+
/* The following are never available with strict SYSV curses */
1752+
#ifdef ACS_S3
17441753
SetDictInt("ACS_S3", (ACS_S3));
1754+
#endif
1755+
#ifdef ACS_S7
1756+
SetDictInt("ACS_S7", (ACS_S7));
1757+
#endif
1758+
#ifdef ACS_LEQUAL
17451759
SetDictInt("ACS_LEQUAL", (ACS_LEQUAL));
1760+
#endif
1761+
#ifdef ACS_GEQUAL
17461762
SetDictInt("ACS_GEQUAL", (ACS_GEQUAL));
1763+
#endif
1764+
#ifdef ACS_PI
17471765
SetDictInt("ACS_PI", (ACS_PI));
1766+
#endif
1767+
#ifdef ACS_NEQUAL
17481768
SetDictInt("ACS_NEQUAL", (ACS_NEQUAL));
1769+
#endif
1770+
#ifdef ACS_STERLING
17491771
SetDictInt("ACS_STERLING", (ACS_STERLING));
17501772
#endif
17511773

@@ -2270,12 +2292,24 @@ init_curses(void)
22702292
SetDictInt("A_PROTECT", A_PROTECT);
22712293
SetDictInt("A_CHARTEXT", A_CHARTEXT);
22722294
SetDictInt("A_COLOR", A_COLOR);
2273-
#ifndef STRICT_SYSV_CURSES
2295+
2296+
/* The following are never available with strict SYSV curses */
2297+
#ifdef A_HORIZONTAL
22742298
SetDictInt("A_HORIZONTAL", A_HORIZONTAL);
2299+
#endif
2300+
#ifdef A_LEFT
22752301
SetDictInt("A_LEFT", A_LEFT);
2302+
#endif
2303+
#ifdef A_LOW
22762304
SetDictInt("A_LOW", A_LOW);
2305+
#endif
2306+
#ifdef A_RIGHT
22772307
SetDictInt("A_RIGHT", A_RIGHT);
2308+
#endif
2309+
#ifdef A_TOP
22782310
SetDictInt("A_TOP", A_TOP);
2311+
#endif
2312+
#ifdef A_VERTICAL
22792313
SetDictInt("A_VERTICAL", A_VERTICAL);
22802314
#endif
22812315

0 commit comments

Comments
 (0)