From 6543e88d2ac6a5d4dd7e6e4aae3305eeeaa65d8f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 16 Feb 1999 19:40:02 +0000 Subject: [PATCH] Check for potential error returned by _ungetch(). --- PC/msvcrtmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index fd46c0f3c26..21be21a5c9f 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; }