summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-01 21:42:23 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-01 21:42:23 (GMT)
commit435b0f2491011ec67ed5a2fa14ae1c983b65e57d (patch)
tree6bd04b6c1c8732078e01996fe89653992f698161
parent8966c99bb5a6c15d9963a5ad394f1ff01c036164 (diff)
downloadcpython-435b0f2491011ec67ed5a2fa14ae1c983b65e57d.zip
cpython-435b0f2491011ec67ed5a2fa14ae1c983b65e57d.tar.gz
cpython-435b0f2491011ec67ed5a2fa14ae1c983b65e57d.tar.bz2
use C character code to simplify #5410
-rwxr-xr-xPC/msvcrtmodule.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index f441aa3..3ef1b7c 100755
--- a/PC/msvcrtmodule.c
+++ b/PC/msvcrtmodule.c
@@ -220,18 +220,12 @@ msvcrt_putch(PyObject *self, PyObject *args)
static PyObject *
msvcrt_putwch(PyObject *self, PyObject *args)
{
- Py_UNICODE *ch;
- int size;
+ int ch;
- if (!PyArg_ParseTuple(args, "u#:putwch", &ch, &size))
+ if (!PyArg_ParseTuple(args, "C:putwch", &ch))
return NULL;
- if (size == 0) {
- PyErr_SetString(PyExc_ValueError,
- "Expected unicode string of length 1");
- return NULL;
- }
- _putwch(*ch);
+ _putwch(ch);
Py_RETURN_NONE;
}
@@ -255,12 +249,12 @@ msvcrt_ungetch(PyObject *self, PyObject *args)
static PyObject *
msvcrt_ungetwch(PyObject *self, PyObject *args)
{
- Py_UNICODE ch;
+ int ch;
- if (!PyArg_ParseTuple(args, "u:ungetwch", &ch))
+ if (!PyArg_ParseTuple(args, "C:ungetwch", &ch))
return NULL;
- if (_ungetch(ch) == EOF)
+ if (_ungetwch(ch) == WEOF)
return PyErr_SetFromErrno(PyExc_IOError);
Py_INCREF(Py_None);
return Py_None;