summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-05-31 08:24:56 (GMT)
committerGitHub <noreply@github.com>2021-05-31 08:24:56 (GMT)
commitd1124b09e8251061dc040cbd396f35ae57783f4a (patch)
treec2817d08e92a824e483248bee71491f70119306a /Modules/_sqlite/statement.c
parent4b20f2574d412f4c4a5b1ab799d8e71a5dd3b766 (diff)
downloadcpython-d1124b09e8251061dc040cbd396f35ae57783f4a.zip
cpython-d1124b09e8251061dc040cbd396f35ae57783f4a.tar.gz
cpython-d1124b09e8251061dc040cbd396f35ae57783f4a.tar.bz2
bpo-42972: Fix sqlite3 traverse/clear functions (GH-26452)
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r--Modules/_sqlite/statement.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 3be12c7..332bf03 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -373,6 +373,9 @@ stmt_dealloc(pysqlite_Statement *self)
{
PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
+ if (self->in_weakreflist != NULL) {
+ PyObject_ClearWeakRefs((PyObject*)self);
+ }
tp->tp_clear((PyObject *)self);
tp->tp_free(self);
Py_DECREF(tp);
@@ -389,17 +392,14 @@ stmt_clear(pysqlite_Statement *self)
}
Py_CLEAR(self->sql);
- if (self->in_weakreflist != NULL) {
- PyObject_ClearWeakRefs((PyObject*)self);
- }
return 0;
}
static int
stmt_traverse(pysqlite_Statement *self, visitproc visit, void *arg)
{
- Py_VISIT(self->sql);
Py_VISIT(Py_TYPE(self));
+ Py_VISIT(self->sql);
return 0;
}