Skip to content

Commit

Permalink
* psycopg/adapter_asis.c (asis_traverse): add cyclic GC traversal
Browse files Browse the repository at this point in the history
	for AsIs adapters.
  • Loading branch information
jhenstridge committed Jul 1, 2008
1 parent fd538a8 commit 47d2414
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2008-07-01 James Henstridge <james@jamesh.id.au>

* psycopg/adapter_asis.c (asis_traverse): add cyclic GC traversal
for AsIs adapters.

* psycopg/adapter_list.c (list_traverse): add cyclic GC traversal
for list adapters.

Expand Down
13 changes: 10 additions & 3 deletions psycopg/adapter_asis.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ asis_setup(asisObject *self, PyObject *obj)
return 0;
}

static int
asis_traverse(asisObject *self, visitproc visit, void *arg)
{
Py_VISIT(self->wrapped);
return 0;
}

static void
asis_dealloc(PyObject* obj)
{
Expand Down Expand Up @@ -141,7 +148,7 @@ asis_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
asis_del(PyObject* self)
{
PyObject_Del(self);
PyObject_GC_Del(self);
}

static PyObject *
Expand Down Expand Up @@ -183,10 +190,10 @@ PyTypeObject asisType = {
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*/
asisType_doc, /*tp_doc*/

0, /*tp_traverse*/
(traverseproc)asis_traverse, /*tp_traverse*/
0, /*tp_clear*/

0, /*tp_richcompare*/
Expand Down

0 comments on commit 47d2414

Please sign in to comment.