Skip to content

Commit 36ae3eb

Browse files
author
Erlend E. Aasland
committed
bpo-42972: Track sqlite3 statement objects
1 parent d1124b0 commit 36ae3eb

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Modules/_sqlite/connection.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,7 @@ pysqlite_connection_call(pysqlite_Connection *self, PyObject *args,
13631363
statement->in_weakreflist = NULL;
13641364

13651365
rc = pysqlite_statement_create(statement, self, sql);
1366+
PyObject_GC_Track(statement);
13661367
if (rc != SQLITE_OK) {
13671368
if (rc == PYSQLITE_TOO_MUCH_SQL) {
13681369
PyErr_SetString(pysqlite_Warning, "You can only execute one statement at a time.");

Modules/_sqlite/cursor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
512512
goto error;
513513
}
514514
rc = pysqlite_statement_create(self->statement, self->connection, operation);
515+
PyObject_GC_Track(self->statement);
515516
if (rc != SQLITE_OK) {
516517
Py_CLEAR(self->statement);
517518
goto error;

0 commit comments

Comments
 (0)