Commits

Nadeem Vawda  committed d98b5e0

Fix build error in _curses module when not using libncursesw.

Code extracted from Victor Stinner's patch for issue #12567.

  • Participants
  • Parent commits 372679f

Comments (0)

Files changed (2)

File Modules/_cursesmodule.c

     }
 }
 
+#ifdef HAVE_NCURSESW
 static PyObject *
 PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
 {
     }
     return PyLong_FromLong(rtn);
 }
+#endif
 
 static PyObject *
 PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
     {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
     {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
     {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
+#ifdef HAVE_NCURSESW
     {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
+#endif
     {"getmaxyx",        (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
     {"getparyx",        (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},
     {"getstr",          (PyCFunction)PyCursesWindow_GetStr, METH_VARARGS},
         else:
             missing.extend(['nis', 'resource', 'termios'])
 
+        curses_defines = []
+        if curses_library == 'ncursesw':
+            curses_defines.append(('HAVE_NCURSESW', '1'))
+
         # Curses support, requiring the System V version of curses, often
         # provided by the ncurses library.
         panel_library = 'panel'
                 panel_library = 'panelw'
             curses_libs = [curses_library]
             exts.append( Extension('_curses', ['_cursesmodule.c'],
+                                   define_macros=curses_defines,
                                    libraries = curses_libs) )
         elif curses_library == 'curses' and platform != 'darwin':
                 # OSX has an old Berkeley curses, not good enough for
                 curses_libs = ['curses']
 
             exts.append( Extension('_curses', ['_cursesmodule.c'],
+                                   define_macros=curses_defines,
                                    libraries = curses_libs) )
         else:
             missing.append('_curses')