Skip to content

Commit 239ead3

Browse files
pythongh-94028: Clear and reset sqlite3 statements properly in cursor iternext
1 parent 1603a10 commit 239ead3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_sqlite/cursor.c

+3
Original file line numberDiff line numberDiff line change
@@ -1129,10 +1129,13 @@ pysqlite_cursor_iternext(pysqlite_Cursor *self)
11291129
self->rowcount = (long)sqlite3_changes(self->connection->db);
11301130
}
11311131
(void)stmt_reset(self->statement);
1132+
Py_CLEAR(self->statement);
11321133
}
11331134
else if (rc != SQLITE_ROW) {
11341135
(void)_pysqlite_seterror(self->connection->state,
11351136
self->connection->db);
1137+
(void)stmt_reset(self->statement);
1138+
Py_CLEAR(self->statement);
11361139
Py_DECREF(row);
11371140
return NULL;
11381141
}

0 commit comments

Comments
 (0)