From 454bd3a277fb725aec02c844cd8ad9af2d222fbf Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 24 Mar 2015 13:40:29 +0100 Subject: stdprinter_write(): mention the encoding --- Objects/fileobject.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 6f2e351..1b18410 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -372,7 +372,7 @@ PyFile_NewStdPrinter(int fd) static PyObject * stdprinter_write(PyStdPrinter_Object *self, PyObject *args) { - char *c; + char *str; Py_ssize_t n; if (self->fd < 0) { @@ -383,10 +383,11 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args) Py_RETURN_NONE; } - if (!PyArg_ParseTuple(args, "s", &c)) + /* encode Unicode to UTF-8 */ + if (!PyArg_ParseTuple(args, "s", &str)) return NULL; - n = _Py_write(self->fd, c, strlen(c)); + n = _Py_write(self->fd, str, strlen(str)); if (n == -1) { if (errno == EAGAIN) { PyErr_Clear(); -- cgit v0.12