22661864 py3 curses get_wch() returns char in int, upstream returns it in str
authorJohn Beck <John.Beck@Oracle.COM>
Thu, 18 Feb 2016 08:19:13 -0800
changeset 5476 f1df93f6aff1
parent 5475 8ed6e5dc51bc
child 5477 5eabbdf042bc
22661864 py3 curses get_wch() returns char in int, upstream returns it in str
components/python/python34/patches/03-setup.patch
components/python/python34/patches/13-get_wch.patch
components/python/python35/patches/03-setup.patch
components/python/python35/patches/13-get_wch.patch
--- a/components/python/python34/patches/03-setup.patch	Thu Feb 18 18:29:18 2016 -0800
+++ b/components/python/python34/patches/03-setup.patch	Thu Feb 18 08:19:13 2016 -0800
@@ -48,11 +48,13 @@
          # Detect SSL support for the socket module (via _ssl)
          search_for_ssl_incs_in = [
                                '/usr/local/ssl/include',
-@@ -1295,6 +1306,8 @@
+@@ -1295,6 +1306,10 @@
              curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
  
          if curses_library.startswith('ncurses'):
 +            if host_platform == 'sunos5':
++                curses_defines.append(('HAVE_NCURSESW', '1'))
++                curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
 +                curses_includes.append('/usr/include/ncurses')
              curses_libs = [curses_library]
              exts.append( Extension('_curses', ['_cursesmodule.c'],
--- a/components/python/python34/patches/13-get_wch.patch	Thu Feb 18 18:29:18 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-This patch adds wget_wch support to the curses module.  It may be contributed
-upstream at some point, but the suitability (or lack thereof) has not yet
-been determined.
-
---- Python-3.4.0/Modules/_cursesmodule.c.~1~	2014-03-16 19:31:31.000000000 -0700
-+++ Python-3.4.0/Modules/_cursesmodule.c	2014-03-17 13:44:21.194828659 -0700
-@@ -1187,6 +1187,37 @@
- }
- 
- static PyObject *
-+PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
-+{
-+    int x, y;
-+    int ct;
-+    wint_t rtn;
-+
-+    switch (PyTuple_Size(args)) {
-+    case 0:
-+        Py_BEGIN_ALLOW_THREADS
-+        ct = wget_wch(self->win,&rtn);
-+        Py_END_ALLOW_THREADS
-+        break;
-+    case 2:
-+        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
-+            return NULL;
-+        Py_BEGIN_ALLOW_THREADS
-+        ct = mvwget_wch(self->win,y,x,&rtn);
-+        Py_END_ALLOW_THREADS
-+        break;
-+    default:
-+        PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
-+        return NULL;
-+    }
-+    if (ct == ERR) {
-+        PyErr_SetString(PyCursesError, "get_wch failed");
-+        return NULL;
-+    }
-+    return PyLong_FromLong((long)rtn);
-+}
-+
-+static PyObject *
- PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
- {
-     int x, y;
-@@ -2059,6 +2090,7 @@
-     {"getbegyx",        (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
-     {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
-     {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
-+    {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
-     {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
- #ifdef HAVE_NCURSESW
-     {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
--- a/components/python/python35/patches/03-setup.patch	Thu Feb 18 18:29:18 2016 -0800
+++ b/components/python/python35/patches/03-setup.patch	Thu Feb 18 08:19:13 2016 -0800
@@ -48,11 +48,13 @@
          # Detect SSL support for the socket module (via _ssl)
          search_for_ssl_incs_in = [
                                '/usr/local/ssl/include',
-@@ -1315,6 +1326,8 @@
+@@ -1315,6 +1326,10 @@
              curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
  
          if curses_library.startswith('ncurses'):
 +            if host_platform == 'sunos5':
++                curses_defines.append(('HAVE_NCURSESW', '1'))
++                curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
 +                curses_includes.append('/usr/include/ncurses')
              curses_libs = [curses_library]
              exts.append( Extension('_curses', ['_cursesmodule.c'],
--- a/components/python/python35/patches/13-get_wch.patch	Thu Feb 18 18:29:18 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-This patch adds wget_wch support to the curses module.  It may be contributed
-upstream at some point, but the suitability (or lack thereof) has not yet
-been determined.
-
---- Python-3.5.0a4/Modules/_cursesmodule.c.~1~	2015-04-20 00:37:52.000000000 -0700
-+++ Python-3.5.0a4/Modules/_cursesmodule.c	2015-04-20 13:48:38.959560525 -0700
-@@ -1124,6 +1124,37 @@
- }
- 
- static PyObject *
-+PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
-+{
-+    int x, y;
-+    int ct;
-+    wint_t rtn;
-+
-+    switch (PyTuple_Size(args)) {
-+    case 0:
-+        Py_BEGIN_ALLOW_THREADS
-+        ct = wget_wch(self->win,&rtn);
-+        Py_END_ALLOW_THREADS
-+        break;
-+    case 2:
-+        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
-+            return NULL;
-+        Py_BEGIN_ALLOW_THREADS
-+        ct = mvwget_wch(self->win,y,x,&rtn);
-+        Py_END_ALLOW_THREADS
-+        break;
-+    default:
-+        PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
-+        return NULL;
-+    }
-+    if (ct == ERR) {
-+        PyErr_SetString(PyCursesError, "get_wch failed");
-+        return NULL;
-+    }
-+    return PyLong_FromLong((long)rtn);
-+}
-+
-+static PyObject *
- PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
- {
-     int x, y;
-@@ -1996,6 +2027,7 @@
-     {"getbegyx",        (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
-     {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
-     {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
-+    {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
-     {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
- #ifdef HAVE_NCURSESW
-     {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},