summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--psycopg/adapter_binary.c17
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f068d97..089950d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2008-07-01 James Henstridge <james@jamesh.id.au>
+ * psycopg/adapter_binary.c (binary_traverse): add cyclic GC
+ traversal for binary adapters.
+
* psycopg/adapter_asis.c (asis_traverse): add cyclic GC traversal
for AsIs adapters.
diff --git a/psycopg/adapter_binary.c b/psycopg/adapter_binary.c
index 1fb9d40..205a5e2 100644
--- a/psycopg/adapter_binary.c
+++ b/psycopg/adapter_binary.c
@@ -266,6 +266,17 @@ binary_setup(binaryObject *self, PyObject *str)
return 0;
}
+static int
+binary_traverse(PyObject *obj, visitproc visit, void *arg)
+{
+ binaryObject *self = (binaryObject *)obj;
+
+ Py_VISIT(self->wrapped);
+ Py_VISIT(self->buffer);
+ Py_VISIT(self->conn);
+ return 0;
+}
+
static void
binary_dealloc(PyObject* obj)
{
@@ -303,7 +314,7 @@ binary_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
binary_del(PyObject* self)
{
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
@@ -341,11 +352,11 @@ PyTypeObject binaryType = {
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*/
binaryType_doc, /*tp_doc*/
- 0, /*tp_traverse*/
+ binary_traverse, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/