stdprinter_write(): mention the encoding

This commit is contained in:
Victor Stinner 2015-03-24 13:40:29 +01:00
parent 3b06dfb9d1
commit 454bd3a277
1 changed files with 4 additions and 3 deletions

View File

@ -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();