summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-06-13 08:20:46 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-06-13 08:20:46 (GMT)
commit47edb4b09ce4694e5585497581a1a0e7e047e393 (patch)
tree9b6ece00c41e242751d32a29c50de15eddeaff6b
parent59efe363b6149e1f1860517c53bbdf2745536b42 (diff)
downloadcpython-47edb4b09ce4694e5585497581a1a0e7e047e393.zip
cpython-47edb4b09ce4694e5585497581a1a0e7e047e393.tar.gz
cpython-47edb4b09ce4694e5585497581a1a0e7e047e393.tar.bz2
Remove unnecessary GC support. Sets cannot have cycles.
-rw-r--r--Objects/setobject.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 47415e6..3dc11d4 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -114,21 +114,12 @@ frozenset_dict_wrapper(PyObject *d)
static void
set_dealloc(PySetObject *so)
{
- PyObject_GC_UnTrack(so);
if (so->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) so);
Py_XDECREF(so->data);
so->ob_type->tp_free(so);
}
-static int
-set_traverse(PySetObject *so, visitproc visit, void *arg)
-{
- if (so->data)
- return visit(so->data, arg);
- return 0;
-}
-
static PyObject *
set_iter(PySetObject *so)
{
@@ -1017,11 +1008,11 @@ PyTypeObject PySet_Type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES |
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
set_doc, /* tp_doc */
- (traverseproc)set_traverse, /* tp_traverse */
- (inquiry)set_tp_clear, /* tp_clear */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
(richcmpfunc)set_richcompare, /* tp_richcompare */
offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */
(getiterfunc)set_iter, /* tp_iter */
@@ -1037,7 +1028,7 @@ PyTypeObject PySet_Type = {
(initproc)set_init, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
set_new, /* tp_new */
- PyObject_GC_Del, /* tp_free */
+ PyObject_Del, /* tp_free */
};
/* frozenset object ********************************************************/
@@ -1112,10 +1103,10 @@ PyTypeObject PyFrozenSet_Type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES |
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */
frozenset_doc, /* tp_doc */
- (traverseproc)set_traverse, /* tp_traverse */
+ 0, /* tp_traverse */
0, /* tp_clear */
(richcmpfunc)set_richcompare, /* tp_richcompare */
offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */
@@ -1132,5 +1123,5 @@ PyTypeObject PyFrozenSet_Type = {
0, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
frozenset_new, /* tp_new */
- PyObject_GC_Del, /* tp_free */
+ PyObject_Del, /* tp_free */
};