summaryrefslogtreecommitdiffstats
path: root/Modules/_csv.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-07 02:35:30 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-07 02:35:30 (GMT)
commit72ca65dce4529906b64710e94a3c004f9cc2712f (patch)
tree7ea8d17a0f090f534175117feae3b4d21a8c0d4d /Modules/_csv.c
parent77ea6409ef95932ce19d48e08b1eb29a65c82ecf (diff)
downloadcpython-72ca65dce4529906b64710e94a3c004f9cc2712f.zip
cpython-72ca65dce4529906b64710e94a3c004f9cc2712f.tar.gz
cpython-72ca65dce4529906b64710e94a3c004f9cc2712f.tar.bz2
Fix a Py_UCS4 / Py_UNICODE mixup.
This worked under Unix because wchar_t is 4 bytes wide.
Diffstat (limited to 'Modules/_csv.c')
-rw-r--r--Modules/_csv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index ee074cf..1334633 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -1127,6 +1127,7 @@ csv_writerow(WriterObj *self, PyObject *seq)
{
DialectObj *dialect = self->dialect;
Py_ssize_t len, i;
+ PyObject *line, *result;
if (!PySequence_Check(seq))
return PyErr_Format(error_obj, "sequence expected");
@@ -1186,9 +1187,13 @@ csv_writerow(WriterObj *self, PyObject *seq)
if (!join_append_lineterminator(self))
return 0;
- return PyObject_CallFunction(self->writeline,
- "(u#)", self->rec,
- self->rec_len);
+ line = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND,
+ (void *) self->rec, self->rec_len);
+ if (line == NULL)
+ return NULL;
+ result = PyObject_CallFunctionObjArgs(self->writeline, line, NULL);
+ Py_DECREF(line);
+ return result;
}
PyDoc_STRVAR(csv_writerows_doc,