summaryrefslogtreecommitdiffstats
path: root/Modules/_csv.c
diff options
context:
space:
mode:
authorLicht Takeuchi <licht-t@outlook.jp>2017-12-12 09:57:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-12-12 09:57:06 (GMT)
commit2001900b0c02a397d8cf1d776a7cc7fcb2a463e3 (patch)
tree87317ebf9cebe56052aa7d913f816903604b4c54 /Modules/_csv.c
parente0720cd9e44d43587e6b6c91fd21d0bb0345ccb9 (diff)
downloadcpython-2001900b0c02a397d8cf1d776a7cc7fcb2a463e3.zip
cpython-2001900b0c02a397d8cf1d776a7cc7fcb2a463e3.tar.gz
cpython-2001900b0c02a397d8cf1d776a7cc7fcb2a463e3.tar.bz2
bpo-32255: Always quote a single empty field when write into a CSV file. (#4769)
This allows to distinguish an empty row from a row consisting of a single empty field.
Diffstat (limited to 'Modules/_csv.c')
-rw-r--r--Modules/_csv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 5314ef6..e616151 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -1238,7 +1238,7 @@ csv_writerow(WriterObj *self, PyObject *seq)
if (PyErr_Occurred())
return NULL;
- if (self->num_fields > 0 && self->rec_size == 0) {
+ if (self->num_fields > 0 && self->rec_len == 0) {
if (dialect->quoting == QUOTE_NONE) {
PyErr_Format(_csvstate_global->error_obj,
"single empty field record must be quoted");