1 parent 3b06dfb commit 454bd3aCopy full SHA for 454bd3a
1 file changed
Objects/fileobject.c
@@ -372,7 +372,7 @@ PyFile_NewStdPrinter(int fd)
372
static PyObject *
373
stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
374
{
375
- char *c;
+ char *str;
376
Py_ssize_t n;
377
378
if (self->fd < 0) {
@@ -383,10 +383,11 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
383
Py_RETURN_NONE;
384
}
385
386
- if (!PyArg_ParseTuple(args, "s", &c))
+ /* encode Unicode to UTF-8 */
387
+ if (!PyArg_ParseTuple(args, "s", &str))
388
return NULL;
389
- n = _Py_write(self->fd, c, strlen(c));
390
+ n = _Py_write(self->fd, str, strlen(str));
391
if (n == -1) {
392
if (errno == EAGAIN) {
393
PyErr_Clear();
0 commit comments