8000 sqlite.PrepareProtocol type now implements GC protocol · python/cpython@4519017 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4519017

Browse files
author
Erlend E. Aasland
committed
sqlite.PrepareProtocol type now implements GC protocol
1 parent 13bc519 commit 4519017

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Modules/_sqlite/prepare_protocol.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,33 @@ pysqlite_prepare_protocol_init(pysqlite_PrepareProtocol *self, PyObject *args,
3030
return 0;
3131
}
3232

33+
static int
34+
pysqlite_prepare_protocol_traverse(PyObject *self, visitproc visit, void *arg)
35+
{
36+
Py_VISIT(Py_TYPE(self));
37+
return 0;
38+
}
39+
3340
static void
3441
pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
3542
{
3643
PyTypeObject *tp = Py_TYPE(self);
37-
44+
PyObject_GC_UnTrack(self);
3845
tp->tp_free(self);
3946
Py_DECREF(tp);
4047
}
4148

4249
static PyType_Slot type_slots[] = {
4350
{Py_tp_dealloc, pysqlite_prepare_protocol_dealloc},
44-
{Py_tp_new, PyType_GenericNew},
4551
{Py_tp_init, pysqlite_prepare_protocol_init},
52+
{Py_tp_traverse, pysqlite_prepare_protocol_traverse},
4653
{0, NULL},
4754
};
4855

4956
static PyType_Spec type_spec = {
5057
.name = MODULE_NAME ".PrepareProtocol",
5158
.basicsize = sizeof(pysqlite_PrepareProtocol),
52-
.flags = Py_TPFLAGS_DEFAULT,
59+
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
5360
.slots = type_slots,
5461
};
5562

0 commit comments

Comments
 (0)
0