summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Henstridge <james@jamesh.id.au>2008-07-18 17:42:31 +0800
committerJames Henstridge <james@jamesh.id.au>2008-07-18 17:42:31 +0800
commite0287c0db4ceb3daca64b2e3dd32397b357b7e3c (patch)
treecd42e800f3b64041cc845f8392cfc452c3a6576f
parent590542e973ebc112e1e7e6f20fca28d7c92bcdb6 (diff)
downloadpsycopg2-e0287c0db4ceb3daca64b2e3dd32397b357b7e3c.tar.gz
* psycopg/adapter_qstring.c (qstring_traverse): add cyclic GC
traversal for quoted string adapters. * psycopg/adapter_pboolean.c (pboolean_traverse): add cyclic GC traversal for boolean adapters. * psycopg/adapter_mxdatetime.c (mxdatetime_traverse): add cyclic GC traversal for mxdatetime adapters. * psycopg/adapter_datetime.c (pydatetime_traverse): add cyclic GC traversal for datetime adapters.
-rw-r--r--ChangeLog14
-rw-r--r--psycopg/adapter_datetime.c15
-rw-r--r--psycopg/adapter_mxdatetime.c15
-rw-r--r--psycopg/adapter_pboolean.c15
-rw-r--r--psycopg/adapter_qstring.c17
5 files changed, 64 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 089950d..024f2a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-07-18 James Henstridge <james@jamesh.id.au>
+
+ * psycopg/adapter_qstring.c (qstring_traverse): add cyclic GC
+ traversal for quoted string adapters.
+
+ * psycopg/adapter_pboolean.c (pboolean_traverse): add cyclic GC
+ traversal for boolean adapters.
+
+ * psycopg/adapter_mxdatetime.c (mxdatetime_traverse): add cyclic
+ GC traversal for mxdatetime adapters.
+
+ * psycopg/adapter_datetime.c (pydatetime_traverse): add cyclic GC
+ traversal for datetime adapters.
+
2008-07-01 James Henstridge <james@jamesh.id.au>
* psycopg/adapter_binary.c (binary_traverse): add cyclic GC
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c
index e9fcc1e..322e019 100644
--- a/psycopg/adapter_datetime.c
+++ b/psycopg/adapter_datetime.c
@@ -140,6 +140,15 @@ pydatetime_setup(pydatetimeObject *self, PyObject *obj, int type)
return 0;
}
+static int
+pydatetime_traverse(PyObject *obj, visitproc visit, void *arg)
+{
+ pydatetimeObject *self = (pydatetimeObject *)obj;
+
+ Py_VISIT(self->wrapped);
+ return 0;
+}
+
static void
pydatetime_dealloc(PyObject* obj)
{
@@ -174,7 +183,7 @@ pydatetime_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
pydatetime_del(PyObject* self)
{
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
@@ -213,11 +222,11 @@ PyTypeObject pydatetimeType = {
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*/
pydatetimeType_doc, /*tp_doc*/
- 0, /*tp_traverse*/
+ pydatetime_traverse, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
diff --git a/psycopg/adapter_mxdatetime.c b/psycopg/adapter_mxdatetime.c
index 48ead92..8750b1b 100644
--- a/psycopg/adapter_mxdatetime.c
+++ b/psycopg/adapter_mxdatetime.c
@@ -162,6 +162,15 @@ mxdatetime_setup(mxdatetimeObject *self, PyObject *obj, int type)
return 0;
}
+static int
+mxdatetime_traverse(PyObject *obj, visitproc visit, void *arg)
+{
+ mxdatetimeObject *self = (mxdatetimeObject *)obj;
+
+ Py_VISIT(self->wrapped);
+ return 0;
+}
+
static void
mxdatetime_dealloc(PyObject* obj)
{
@@ -198,7 +207,7 @@ mxdatetime_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
mxdatetime_del(PyObject* self)
{
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
@@ -237,11 +246,11 @@ PyTypeObject mxdatetimeType = {
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*/
mxdatetimeType_doc, /*tp_doc*/
- 0, /*tp_traverse*/
+ mxdatetime_traverse, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
diff --git a/psycopg/adapter_pboolean.c b/psycopg/adapter_pboolean.c
index 05d1d04..29e3410 100644
--- a/psycopg/adapter_pboolean.c
+++ b/psycopg/adapter_pboolean.c
@@ -116,6 +116,15 @@ pboolean_setup(pbooleanObject *self, PyObject *obj)
return 0;
}
+static int
+pboolean_traverse(PyObject *obj, visitproc visit, void *arg)
+{
+ pbooleanObject *self = (pbooleanObject *)obj;
+
+ Py_VISIT(self->wrapped);
+ return 0;
+}
+
static void
pboolean_dealloc(PyObject* obj)
{
@@ -151,7 +160,7 @@ pboolean_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
pboolean_del(PyObject* self)
{
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
@@ -194,10 +203,10 @@ PyTypeObject pbooleanType = {
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*/
pbooleanType_doc, /*tp_doc*/
- 0, /*tp_traverse*/
+ pboolean_traverse, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
diff --git a/psycopg/adapter_qstring.c b/psycopg/adapter_qstring.c
index 3684039..32185fe 100644
--- a/psycopg/adapter_qstring.c
+++ b/psycopg/adapter_qstring.c
@@ -290,6 +290,17 @@ qstring_setup(qstringObject *self, PyObject *str, const char *enc)
return 0;
}
+static int
+qstring_traverse(PyObject *obj, visitproc visit, void *arg)
+{
+ qstringObject *self = (qstringObject *)obj;
+
+ Py_VISIT(self->wrapped);
+ Py_VISIT(self->buffer);
+ Py_VISIT(self->conn);
+ return 0;
+}
+
static void
qstring_dealloc(PyObject* obj)
{
@@ -330,7 +341,7 @@ qstring_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static void
qstring_del(PyObject* self)
{
- PyObject_Del(self);
+ PyObject_GC_Del(self);
}
static PyObject *
@@ -369,11 +380,11 @@ PyTypeObject qstringType = {
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*/
qstringType_doc, /*tp_doc*/
- 0, /*tp_traverse*/
+ qstring_traverse, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/