[issue27540] msvcrt.ungetwch() calls _ungetch()
Eryk Sun
report at bugs.python.org
Sun Jul 17 11:50:26 EDT 2016
Eryk Sun added the comment:
Parsing the argument is also broken:
static PyObject *
msvcrt_ungetwch(PyObject *self, PyObject *args)
{
Py_UNICODE ch;
if (!PyArg_ParseTuple(args, "u:ungetwch", &ch))
return NULL;
if (_ungetch(ch) == EOF)
return PyErr_SetFromErrno(PyExc_IOError);
Py_INCREF(Py_None);
return Py_None;
}
Format "u" is a `Py_UNICODE *`. There's no "C" format code in 2.x, so it will first have to check that the string length is exactly 1 and then use index 0.
----------
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
stage: -> needs patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27540>
_______________________________________
More information about the Python-bugs-list
mailing list