Merged revisions 75066 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75066 | andrew.kuchling | 2009-09-25 17:23:54 -0500 (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.
........
This commit is contained in:
Benjamin Peterson 2009-10-04 20:40:17 +00:00
parent 0df35a93a2
commit 7e2ef573ed
2 changed files with 12 additions and 4 deletions

View file

@ -890,14 +890,17 @@ PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
/* 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 PyUnicode_FromString(unctrl(rtn));
knp = unctrl(rtn);
#else
return PyUnicode_FromString((const char *)keyname(rtn));
knp = keyname(rtn);
#endif
return PyUnicode_FromString((knp == NULL) ? "" : knp);
}
}
static PyObject *