From: Guido van Rossum Date: Tue, 16 Feb 1999 19:40:02 +0000 (+0000) Subject: Check for potential error returned by _ungetch(). X-Git-Tag: v1.5.2b2~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6543e88d2ac6a5d4dd7e6e4aae3305eeeaa65d8f;p=thirdparty%2FPython%2Fcpython.git Check for potential error returned by _ungetch(). --- diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index fd46c0f3c26c..21be21a5c9f2 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -165,7 +165,8 @@ static PyObject *msvcrt_ungetch(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "c:ungetch", &ch)) return NULL; - _ungetch(ch); + if (_ungetch(ch) == EOF) + return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); return Py_None; }