summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-08-28 23:40:57 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-08-28 23:40:57 (GMT)
commit1d39cde50c9cd485de482ec2cce987482394bff5 (patch)
treef9226b5293d8f864bc4e8cea55e2d8c68fbb3713 /Modules
parent4e07a8c9aa5275c7a8161e02fba29e8170f0c212 (diff)
downloadcpython-1d39cde50c9cd485de482ec2cce987482394bff5.zip
cpython-1d39cde50c9cd485de482ec2cce987482394bff5.tar.gz
cpython-1d39cde50c9cd485de482ec2cce987482394bff5.tar.bz2
Issue #15785: Modify window.get_wch() API of the curses module: return a
character for most keys, and an integer for special keys, instead of always returning an integer. So it is now possible to distinguish special keys like keypad keys.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_cursesmodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index de45f51..0436e7f 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1203,7 +1203,10 @@ PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
PyErr_SetString(PyCursesError, "no input");
return NULL;
}
- return PyLong_FromLong(rtn);
+ if (ct == KEY_CODE_YES)
+ return PyLong_FromLong(rtn);
+ else
+ return PyUnicode_FromOrdinal(rtn);
}
#endif