Skip to content

Commit 1836417

Browse files
committed
move error_after_iter
1 parent d677161 commit 1836417

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Modules/_csv.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,8 +1340,7 @@ csv_writerow(PyObject *op, PyObject *seq)
13401340
dialect->quoting == QUOTE_NOTNULL))) {
13411341
PyErr_SetString(self->error_obj,
13421342
"single empty field record must be quoted");
1343-
PyUnicodeWriter_Discard(writer);
1344-
return NULL;
1343+
goto error_after_iter;
13451344
}
13461345
if (PyUnicodeWriter_WriteChar(writer, dialect->quotechar) < 0) {
13471346
goto error_after_iter;
@@ -1352,9 +1351,7 @@ csv_writerow(PyObject *op, PyObject *seq)
13521351
}
13531352

13541353
if (PyUnicodeWriter_WriteStr(writer, self->dialect->lineterminator) < 0) {
1355-
error_after_iter:
1356-
PyUnicodeWriter_Discard(writer);
1357-
return NULL;
1354+
goto error_after_iter;
13581355
}
13591356

13601357
line = PyUnicodeWriter_Finish(writer);
@@ -1368,6 +1365,7 @@ csv_writerow(PyObject *op, PyObject *seq)
13681365

13691366
error:
13701367
Py_XDECREF(iter);
1368+
error_after_iter:
13711369
PyUnicodeWriter_Discard(writer);
13721370
return NULL;
13731371
}

0 commit comments

Comments
 (0)