Skip to content

Commit

Permalink
Don't leak records after raising StopIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
MKuranowski committed Apr 25, 2024
1 parent d92c113 commit a2ca38c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions aiocsv/_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ static PyObject* Parser_next(Parser* self) {
// Generate a row or stop iteration altogether
if (record) {
PyErr_SetObject(PyExc_StopIteration, record);
Py_DECREF(record);
} else {
PyErr_SetNone(PyExc_StopAsyncIteration);
}
Expand Down

0 comments on commit a2ca38c

Please sign in to comment.