Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b80b378

Browse files
committed
Issue #19437: Fix parse_save_field() of the csv module, handle PyList_Append()
failure
1 parent 1eadd6a commit b80b378

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Modules/_csv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ parse_save_field(ReaderObj *self)
546546
return -1;
547547
field = tmp;
548548
}
549-
PyList_Append(self->fields, field);
549+
if (PyList_Append(self->fields, field) < 0) {
550+
Py_DECREF(field);
551+
return -1;
552+
}
550553
Py_DECREF(field);
551554
return 0;
552555
}

0 commit comments

Comments
 (0)