Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-42972: Track sqlite3 statement objects
  • Loading branch information
Erlend E. Aasland
Erlend E. Aasland committed May 31, 2021
commit 36ae3eb25ab9c1c7f8d159a2ac3a000d66dd3ed8
1 change: 1 addition & 0 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,7 @@ pysqlite_connection_call(pysqlite_Connection *self, PyObject *args,
statement->in_weakreflist = NULL;

rc = pysqlite_statement_create(statement, self, sql);
PyObject_GC_Track(statement);
if (rc != SQLITE_OK) {
if (rc == PYSQLITE_TOO_MUCH_SQL) {
PyErr_SetString(pysqlite_Warning, "You can only execute one statement at a time.");
Expand Down
1 change: 1 addition & 0 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
goto error;
}
rc = pysqlite_statement_create(self->statement, self->connection, operation);
Comment thread
erlend-aasland marked this conversation as resolved.
Resolved
PyObject_GC_Track(self->statement);
if (rc != SQLITE_OK) {
Py_CLEAR(self->statement);
goto error;
Expand Down