diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-08-28 23:40:57 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-08-28 23:40:57 (GMT) |
commit | 1d39cde50c9cd485de482ec2cce987482394bff5 (patch) | |
tree | f9226b5293d8f864bc4e8cea55e2d8c68fbb3713 /Modules | |
parent | 4e07a8c9aa5275c7a8161e02fba29e8170f0c212 (diff) | |
download | cpython-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.c | 5 |
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 |