Commits

Anonymous committed 27f6fd8

Fix a Py_UCS4 / Py_UNICODE mixup.
This worked under Unix because wchar_t is 4 bytes wide.

Comments (0)

Files changed (1)

 {
     DialectObj *dialect = self->dialect;
     Py_ssize_t len, i;
+    PyObject *line, *result;
 
     if (!PySequence_Check(seq))
         return PyErr_Format(error_obj, "sequence expected");
     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,