diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2021-05-25 17:43:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-25 17:43:56 (GMT) |
commit | d3c277a59c3d93fb92f7026f63678083d1d49fc5 (patch) | |
tree | 358ab71ed93b2e286e3f94efbdc2e55ddebc5c1b /Modules/_sqlite/prepare_protocol.c | |
parent | d18e5dae914b1db49b25ed7729c07a535d1f0c52 (diff) | |
download | cpython-d3c277a59c3d93fb92f7026f63678083d1d49fc5.zip cpython-d3c277a59c3d93fb92f7026f63678083d1d49fc5.tar.gz cpython-d3c277a59c3d93fb92f7026f63678083d1d49fc5.tar.bz2 |
bpo-42972: Fully implement GC protocol for sqlite3 heap types (GH-26104)
Diffstat (limited to 'Modules/_sqlite/prepare_protocol.c')
-rw-r--r-- | Modules/_sqlite/prepare_protocol.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/_sqlite/prepare_protocol.c b/Modules/_sqlite/prepare_protocol.c index 7d2d7ad..ece42f4 100644 --- a/Modules/_sqlite/prepare_protocol.c +++ b/Modules/_sqlite/prepare_protocol.c @@ -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, }; |