summaryrefslogtreecommitdiff
path: root/Objects/iterobject.c
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2002-03-18 20:43:51 +0000
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2002-03-18 20:43:51 +0000
commitdbf409fbfc476cbe6c0282895ba2cad9e36aa7ca (patch)
treea4d0c4b87a877629bd195f384e98c7ad6f0752d5 /Objects/iterobject.c
parentd164837856562de5f228898039e4ca75bc90d204 (diff)
downloadcpython-git-dbf409fbfc476cbe6c0282895ba2cad9e36aa7ca.tar.gz
Re-enable GC of iter objects.
Diffstat (limited to 'Objects/iterobject.c')
-rw-r--r--Objects/iterobject.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index 5783d2085b..789eb6c689 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -12,22 +12,21 @@ PyObject *
PySeqIter_New(PyObject *seq)
{
seqiterobject *it;
- it = PyObject_NEW(seqiterobject, &PySeqIter_Type);
+ it = PyObject_GC_New(seqiterobject, &PySeqIter_Type);
if (it == NULL)
return NULL;
it->it_index = 0;
Py_INCREF(seq);
it->it_seq = seq;
- PyObject_GC_Init(it);
+ _PyObject_GC_TRACK(it);
return (PyObject *)it;
}
static void
iter_dealloc(seqiterobject *it)
{
- PyObject_GC_Fini(it);
+ _PyObject_GC_UNTRACK(it);
Py_DECREF(it->it_seq);
- it = (seqiterobject *) PyObject_AS_GC(it);
- PyObject_DEL(it);
+ PyObject_GC_Del(it);
}
static int
@@ -100,7 +99,7 @@ PyTypeObject PySeqIter_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size */
"iterator", /* tp_name */
- sizeof(seqiterobject) + PyGC_HEAD_SIZE, /* tp_basicsize */
+ sizeof(seqiterobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)iter_dealloc, /* tp_dealloc */
@@ -118,7 +117,7 @@ PyTypeObject PySeqIter_Type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
0, /* tp_doc */
(traverseproc)iter_traverse, /* tp_traverse */
0, /* tp_clear */
@@ -147,24 +146,23 @@ PyObject *
PyCallIter_New(PyObject *callable, PyObject *sentinel)
{
calliterobject *it;
- it = PyObject_NEW(calliterobject, &PyCallIter_Type);
+ it = PyObject_GC_New(calliterobject, &PyCallIter_Type);
if (it == NULL)
return NULL;
Py_INCREF(callable);
it->it_callable = callable;
Py_INCREF(sentinel);
it->it_sentinel = sentinel;
- PyObject_GC_Init(it);
+ _PyObject_GC_TRACK(it);
return (PyObject *)it;
}
static void
calliter_dealloc(calliterobject *it)
{
- PyObject_GC_Fini(it);
+ _PyObject_GC_UNTRACK(it);
Py_DECREF(it->it_callable);
Py_DECREF(it->it_sentinel);
- it = (calliterobject *) PyObject_AS_GC(it);
- PyObject_DEL(it);
+ PyObject_GC_Del(it);
}
static int
@@ -218,7 +216,7 @@ PyTypeObject PyCallIter_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /* ob_size */
"callable-iterator", /* tp_name */
- sizeof(calliterobject) + PyGC_HEAD_SIZE,/* tp_basicsize */
+ sizeof(calliterobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
(destructor)calliter_dealloc, /* tp_dealloc */
@@ -236,7 +234,7 @@ PyTypeObject PyCallIter_Type = {
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
0, /* tp_doc */
(traverseproc)calliter_traverse, /* tp_traverse */
0, /* tp_clear */