Dropped GC support for several objects

Non-containers don't need GC. It was half-baked anyway
as the tp_clear was often not set. Dropped tp_traverse too
for these objects as unused.
This commit is contained in:
Daniele Varrazzo 2013-04-05 01:02:47 +01:00
parent 95ff64d739
commit e14440d96d
10 changed files with 20 additions and 110 deletions

View File

@ -117,13 +117,6 @@ 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)
{
@ -187,9 +180,9 @@ PyTypeObject asisType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
asisType_doc, /*tp_doc*/
(traverseproc)asis_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -221,17 +221,6 @@ 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)
{
@ -296,9 +285,9 @@ PyTypeObject binaryType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
binaryType_doc, /*tp_doc*/
binary_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -183,15 +183,6 @@ 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)
{
@ -254,9 +245,9 @@ PyTypeObject pydatetimeType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
pydatetimeType_doc, /*tp_doc*/
pydatetime_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -172,15 +172,6 @@ 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)
{
@ -245,9 +236,9 @@ PyTypeObject mxdatetimeType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
mxdatetimeType_doc, /*tp_doc*/
mxdatetime_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -114,15 +114,6 @@ 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)
{
@ -187,9 +178,9 @@ PyTypeObject pbooleanType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
pbooleanType_doc, /*tp_doc*/
pboolean_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -170,15 +170,6 @@ pdecimal_setup(pdecimalObject *self, PyObject *obj)
return 0;
}
static int
pdecimal_traverse(PyObject *obj, visitproc visit, void *arg)
{
pdecimalObject *self = (pdecimalObject *)obj;
Py_VISIT(self->wrapped);
return 0;
}
static void
pdecimal_dealloc(PyObject* obj)
{
@ -243,9 +234,9 @@ PyTypeObject pdecimalType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
pdecimalType_doc, /*tp_doc*/
pdecimal_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -143,15 +143,6 @@ pfloat_setup(pfloatObject *self, PyObject *obj)
return 0;
}
static int
pfloat_traverse(PyObject *obj, visitproc visit, void *arg)
{
pfloatObject *self = (pfloatObject *)obj;
Py_VISIT(self->wrapped);
return 0;
}
static void
pfloat_dealloc(PyObject* obj)
{
@ -216,9 +207,9 @@ PyTypeObject pfloatType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
pfloatType_doc, /*tp_doc*/
pfloat_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -129,15 +129,6 @@ pint_setup(pintObject *self, PyObject *obj)
return 0;
}
static int
pint_traverse(PyObject *obj, visitproc visit, void *arg)
{
pintObject *self = (pintObject *)obj;
Py_VISIT(self->wrapped);
return 0;
}
static void
pint_dealloc(PyObject* obj)
{
@ -202,9 +193,9 @@ PyTypeObject pintType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
pintType_doc, /*tp_doc*/
pint_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -209,17 +209,6 @@ qstring_setup(qstringObject *self, PyObject *str)
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)
{
@ -285,9 +274,9 @@ PyTypeObject qstringType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
qstringType_doc, /*tp_doc*/
qstring_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/

View File

@ -133,13 +133,6 @@ diagnostics_init(diagnosticsObject *self, PyObject *args, PyObject *kwds)
return 0;
}
static int
diagnostics_traverse(diagnosticsObject *self, visitproc visit, void *arg)
{
Py_VISIT(self->err);
return 0;
}
static void
diagnostics_dealloc(diagnosticsObject* self)
{
@ -183,9 +176,9 @@ PyTypeObject diagnosticsType = {
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
diagnosticsType_doc, /*tp_doc*/
(traverseproc)diagnostics_traverse, /*tp_traverse*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/