svn+ssh://pythondev@svn.python.org/python/trunk
........
r75066 | andrew.kuchling | 2009-09-25 18:23:54 -0400 (Fri, 25 Sep 2009) | 4 lines
#6243: fix segfault when keyname() returns a NULL pointer.
Bug noted by Trundle, patched by Trundle and Jerry Chen.
........
if curses.LINES != lines - 1 or curses.COLS != cols + 1:
raise RuntimeError, "Expected resizeterm to update LINES and COLS"
+def test_issue6243(stdscr):
+ curses.ungetch(1025)
+ stdscr.getkey()
+
def main(stdscr):
curses.savetty()
try:
window_funcs(stdscr)
test_userptr_without_set(stdscr)
test_resize_term(stdscr)
+ test_issue6243(stdscr)
finally:
curses.resetty()
Library
-------
+- Issue #6243: curses.getkey() can segfault when used with ungetch.
+ Fix by Trundle and Jerry Chen.
+
- Issue #7597: curses.use_env() can now be called before initscr().
Noted by Kan-Ru Chen.
/* getch() returns ERR in nodelay mode */
PyErr_SetString(PyCursesError, "no input");
return NULL;
- } else if (rtn<=255)
+ } else if (rtn<=255) {
return Py_BuildValue("c", rtn);
- else
+ } else {
+ const char *knp;
#if defined(__NetBSD__)
- return PyString_FromString(unctrl(rtn));
+ knp = unctrl(rtn);
#else
- return PyString_FromString((char *)keyname(rtn));
+ knp = keyname(rtn);
#endif
+ return PyString_FromString((knp == NULL) ? "" : knp);
+ }
}
static PyObject *