mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-44079: Strip superfluous statement cache from sqlite3.Connection (GH-25998)
This commit is contained in:
parent
b2f68b1900
commit
243b6c3b8f
4 changed files with 18 additions and 116 deletions
|
@ -118,7 +118,6 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
|
|||
self->st = stmt;
|
||||
self->in_use = 0;
|
||||
self->is_dml = is_dml;
|
||||
self->in_weakreflist = NULL;
|
||||
|
||||
PyObject_GC_Track(self);
|
||||
return self;
|
||||
|
@ -361,23 +360,6 @@ pysqlite_statement_bind_parameters(pysqlite_state *state,
|
|||
}
|
||||
}
|
||||
|
||||
int pysqlite_statement_finalize(pysqlite_Statement* self)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = SQLITE_OK;
|
||||
if (self->st) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
rc = sqlite3_finalize(self->st);
|
||||
Py_END_ALLOW_THREADS
|
||||
self->st = NULL;
|
||||
}
|
||||
|
||||
self->in_use = 0;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int pysqlite_statement_reset(pysqlite_Statement* self)
|
||||
{
|
||||
int rc;
|
||||
|
@ -407,9 +389,6 @@ stmt_dealloc(pysqlite_Statement *self)
|
|||
{
|
||||
PyTypeObject *tp = Py_TYPE(self);
|
||||
PyObject_GC_UnTrack(self);
|
||||
if (self->in_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs((PyObject*)self);
|
||||
}
|
||||
if (self->st) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
sqlite3_finalize(self->st);
|
||||
|
@ -497,12 +476,7 @@ static int pysqlite_check_remaining_sql(const char* tail)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static PyMemberDef stmt_members[] = {
|
||||
{"__weaklistoffset__", T_PYSSIZET, offsetof(pysqlite_Statement, in_weakreflist), READONLY},
|
||||
{NULL},
|
||||
};
|
||||
static PyType_Slot stmt_slots[] = {
|
||||
{Py_tp_members, stmt_members},
|
||||
{Py_tp_dealloc, stmt_dealloc},
|
||||
{Py_tp_traverse, stmt_traverse},
|
||||
{0, NULL},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue