summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-06-06 22:12:07 (GMT)
committerGitHub <noreply@github.com>2021-06-06 22:12:07 (GMT)
commit0d12f245523178eb62e22f5da5a276bfc7004ac4 (patch)
tree28c1c1633f468526180f61a253e6c776e904a675 /Modules
parent505624e917a2d3d845304f8d34fccd41f06d4720 (diff)
downloadcpython-0d12f245523178eb62e22f5da5a276bfc7004ac4.zip
cpython-0d12f245523178eb62e22f5da5a276bfc7004ac4.tar.gz
cpython-0d12f245523178eb62e22f5da5a276bfc7004ac4.tar.bz2
bpo-44326: Remove unused members from pysqlite_Statement (GH-26564)
* Remove unused db member of pysqlite_Statement * Remove unused sql method from statement object
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/statement.c16
-rw-r--r--Modules/_sqlite/statement.h2
2 files changed, 2 insertions, 16 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index f12ef67..5c38b46 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -84,9 +84,7 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
return NULL;
}
- self->db = connection->db;
self->st = NULL;
- self->sql = Py_NewRef(sql);
self->in_use = 0;
self->is_dml = 0;
self->in_weakreflist = NULL;
@@ -110,7 +108,7 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
}
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare_v2(self->db,
+ rc = sqlite3_prepare_v2(connection->db,
sql_cstr,
(int)sql_cstr_len + 1,
&self->st,
@@ -120,7 +118,7 @@ pysqlite_statement_create(pysqlite_Connection *connection, PyObject *sql)
PyObject_GC_Track(self);
if (rc != SQLITE_OK) {
- _pysqlite_seterror(self->db);
+ _pysqlite_seterror(connection->db);
goto error;
}
@@ -409,23 +407,14 @@ stmt_dealloc(pysqlite_Statement *self)
Py_END_ALLOW_THREADS
self->st = 0;
}
- tp->tp_clear((PyObject *)self);
tp->tp_free(self);
Py_DECREF(tp);
}
static int
-stmt_clear(pysqlite_Statement *self)
-{
- Py_CLEAR(self->sql);
- return 0;
-}
-
-static int
stmt_traverse(pysqlite_Statement *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
- Py_VISIT(self->sql);
return 0;
}
@@ -507,7 +496,6 @@ static PyType_Slot stmt_slots[] = {
{Py_tp_members, stmt_members},
{Py_tp_dealloc, stmt_dealloc},
{Py_tp_traverse, stmt_traverse},
- {Py_tp_clear, stmt_clear},
{0, NULL},
};
diff --git a/Modules/_sqlite/statement.h b/Modules/_sqlite/statement.h
index e8c86a0..b06f615 100644
--- a/Modules/_sqlite/statement.h
+++ b/Modules/_sqlite/statement.h
@@ -32,9 +32,7 @@
typedef struct
{
PyObject_HEAD
- sqlite3* db;
sqlite3_stmt* st;
- PyObject* sql;
int in_use;
int is_dml;
PyObject* in_weakreflist; /* List of weak references */