summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--psycopg/adapter_list.c16
2 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a58f1f..e594ef2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-01 James Henstridge <james@jamesh.id.au>
+
+ * psycopg/adapter_list.c (list_traverse): add cyclic GC traversal
+ for list adapters.
+
2008-05-28 James Henstridge <james@jamesh.id.au>
* psycopg/cursor_type.c (cursor_setup): incref before setting
diff --git a/psycopg/adapter_list.c b/psycopg/adapter_list.c
index b6022bd..a1a9f59 100644
--- a/psycopg/adapter_list.c
+++ b/psycopg/adapter_list.c
@@ -179,6 +179,16 @@ list_setup(listObject *self, PyObject *obj, const char *enc)
return 0;
}
+static int
+list_traverse(PyObject *obj, visitproc visit, void *arg)
+{
+ listObject *self = (listObject *)obj;
+
+ Py_VISIT(self->wrapped);
+ Py_VISIT(self->connection);
+ return 0;
+}
+
static void
list_dealloc(PyObject* obj)
{
@@ -215,7 +225,7 @@ list_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
list_del(PyObject* self)
{
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
@@ -253,11 +263,11 @@ PyTypeObject listType = {
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
listType_doc, /*tp_doc*/
- 0, /*tp_traverse*/
+ list_traverse, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/