mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-42972: Fully implement GC protocol for sqlite3 heap types (GH-26104)
(cherry picked from commit d3c277a59c
)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
This commit is contained in:
parent
05f8ad0c74
commit
e8d9df0089
6 changed files with 192 additions and 74 deletions
|
@ -30,26 +30,33 @@ pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol *self, PyObject *args,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pysqlite_prepare_protocol_traverse(PyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Py_TYPE(self));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
|
||||
{
|
||||
PyTypeObject *tp = Py_TYPE(self);
|
||||
|
||||
PyObject_GC_UnTrack(self);
|
||||
tp->tp_free(self);
|
||||
Py_DECREF(tp);
|
||||
}
|
||||
|
||||
static PyType_Slot type_slots[] = {
|
||||
{Py_tp_dealloc, pysqlite_prepare_protocol_dealloc},
|
||||
{Py_tp_new, PyType_GenericNew},
|
||||
{Py_tp_init, pysqlite_prepare_protocol_init},
|
||||
{Py_tp_traverse, pysqlite_prepare_protocol_traverse},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
static PyType_Spec type_spec = {
|
||||
.name = MODULE_NAME ".PrepareProtocol",
|
||||
.basicsize = sizeof(pysqlite_PrepareProtocol),
|
||||
.flags = Py_TPFLAGS_DEFAULT,
|
||||
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
|
||||
.slots = type_slots,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue