diff options
author | James Henstridge <james@jamesh.id.au> | 2008-07-01 09:34:51 +0800 |
---|---|---|
committer | James Henstridge <james@jamesh.id.au> | 2008-07-01 09:34:51 +0800 |
commit | fd538a8b17e741c611ac0519b2e107cc4fd39fdb (patch) | |
tree | c49f4890f73091d55c19f31ea0c353ee9bd1de14 /psycopg | |
parent | 26693621ef29add6f86354a689dede000d9d962e (diff) | |
download | psycopg2-fd538a8b17e741c611ac0519b2e107cc4fd39fdb.tar.gz |
* psycopg/adapter_list.c (list_traverse): add cyclic GC traversal
for list adapters.
Diffstat (limited to 'psycopg')
-rw-r--r-- | psycopg/adapter_list.c | 16 |
1 files changed, 13 insertions, 3 deletions
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*/ |