mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
merge 3.2: Issue #16013: Fix CSV Reader parsing issue with ending quote characters. Patch by Serhiy Storchaka.
This commit is contained in:
commit
49d130227b
3 changed files with 20 additions and 3 deletions
|
@ -788,9 +788,14 @@ Reader_iternext(ReaderObj *self)
|
|||
lineobj = PyIter_Next(self->input_iter);
|
||||
if (lineobj == NULL) {
|
||||
/* End of input OR exception */
|
||||
if (!PyErr_Occurred() && self->field_len != 0)
|
||||
PyErr_Format(_csvstate_global->error_obj,
|
||||
"newline inside string");
|
||||
if (!PyErr_Occurred() && (self->field_len != 0 ||
|
||||
self->state == IN_QUOTED_FIELD)) {
|
||||
if (self->dialect->strict)
|
||||
PyErr_SetString(_csvstate_global->error_obj,
|
||||
"unexpected end of data");
|
||||
else if (parse_save_field(self) >= 0)
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if (!PyUnicode_Check(lineobj)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue