summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-24 12:40:29 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-24 12:40:29 (GMT)
commit454bd3a277fb725aec02c844cd8ad9af2d222fbf (patch)
treeb85544e649052918129bbde8ee8d9207dfaddef5 /Objects
parent3b06dfb9d13b47d6597bb28b5eda76e9976246ca (diff)
downloadcpython-454bd3a277fb725aec02c844cd8ad9af2d222fbf.zip
cpython-454bd3a277fb725aec02c844cd8ad9af2d222fbf.tar.gz
cpython-454bd3a277fb725aec02c844cd8ad9af2d222fbf.tar.bz2
stdprinter_write(): mention the encoding
Diffstat (limited to 'Objects')
-rw-r--r--Objects/fileobject.c7
1 files 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();