summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-10-04 20:41:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-10-04 20:41:56 (GMT)
commitbf0770dd82b8629af60cb3c16d75a436788f2eca (patch)
tree7133ae0250aa46d5578a7c74b1ae7df41fd2c2ac /Modules
parent5183856c177610ceddb057e3ee90fda85dc2eac1 (diff)
downloadcpython-bf0770dd82b8629af60cb3c16d75a436788f2eca.zip
cpython-bf0770dd82b8629af60cb3c16d75a436788f2eca.tar.gz
cpython-bf0770dd82b8629af60cb3c16d75a436788f2eca.tar.bz2
Merged revisions 75248 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r75248 | benjamin.peterson | 2009-10-04 15:40:17 -0500 (Sun, 04 Oct 2009) | 11 lines 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. ........ ................
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_cursesmodule.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index c7d3778..da19216 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -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 *