Skip to content

Commit 926787d

Browse files
author
Erlend E. Aasland
committed
Clear sqlite3 stmt resources in stmt_clear()
1 parent ab4c6e6 commit 926787d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Modules/_sqlite/statement.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,6 @@ stmt_dealloc(pysqlite_Statement *self)
373373
{
374374
PyTypeObject *tp = Py_TYPE(self);
375375
PyObject_GC_UnTrack(self);
376-
377-
if (self->st) {
378-
Py_BEGIN_ALLOW_THREADS
379-
sqlite3_finalize(self->st);
380-
Py_END_ALLOW_THREADS
381-
self->st = NULL;
382-
}
383-
384376
tp->tp_clear((PyObject *)self);
385377
tp->tp_free(self);
386378
Py_DECREF(tp);
@@ -389,6 +381,13 @@ stmt_dealloc(pysqlite_Statement *self)
389381
static int
390382
stmt_clear(pysqlite_Statement *self)
391383
{
384+
if (self->st) {
385+
Py_BEGIN_ALLOW_THREADS
386+
sqlite3_finalize(self->st);
387+
Py_END_ALLOW_THREADS
388+
self->st = 0;
389+
}
390+
392391
Py_CLEAR(self->sql);
393392
if (self->in_weakreflist != NULL) {
394393
PyObject_ClearWeakRefs((PyObject*)self);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy