mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
e0720cd9e4
commit
2001900b0c
4 changed files with 25 additions and 2 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue