Check for potential error returned by _ungetch().

This commit is contained in:
Guido van Rossum 1999-02-16 19:40:02 +00:00
parent 7d385294a4
commit 6543e88d2a

View file

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