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.
This commit is contained in:
Victor Stinner 2012-08-29 01:40:57 +02:00
parent 4e07a8c9aa
commit 1d39cde50c
4 changed files with 20 additions and 13 deletions

View file

@ -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