mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
bpo-42972: Fix sqlite3 traverse/clear functions (GH-26452)
This commit is contained in:
parent
4b20f2574d
commit
d1124b09e8
6 changed files with 47 additions and 44 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue