summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r--Modules/_sqlite/statement.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index c86645a..c9dd882 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -403,6 +403,10 @@ stmt_dealloc(pysqlite_Statement *self)
if (self->in_weakreflist != NULL) {
PyObject_ClearWeakRefs((PyObject*)self);
}
+ if (self->st) {
+ sqlite3_finalize(self->st);
+ self->st = 0;
+ }
tp->tp_clear((PyObject *)self);
tp->tp_free(self);
Py_DECREF(tp);
@@ -411,13 +415,6 @@ stmt_dealloc(pysqlite_Statement *self)
static int
stmt_clear(pysqlite_Statement *self)
{
- if (self->st) {
- Py_BEGIN_ALLOW_THREADS
- sqlite3_finalize(self->st);
- Py_END_ALLOW_THREADS
- self->st = 0;
- }
-
Py_CLEAR(self->sql);
return 0;
}