]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Check for potential error returned by _ungetch().
authorGuido van Rossum <guido@python.org>
Tue, 16 Feb 1999 19:40:02 +0000 (19:40 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Feb 1999 19:40:02 +0000 (19:40 +0000)
PC/msvcrtmodule.c

index fd46c0f3c26c40083d71071f5ea2101fb3d56328..21be21a5c9f2cb1b6791dc19a935ad2841749739 100755 (executable)
@@ -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;
 }