diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-18 20:45:09 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-18 20:45:09 (GMT) |
commit | 08de92a2672a5856788fe944b23e9851d3e0aaba (patch) | |
tree | 854b72dada5e7f7530a95860fb5ab24c36dbcdfd /Python/ceval.c | |
parent | d91eec9df3d298a1ffb24b17241ee8af283abf2c (diff) | |
download | cpython-08de92a2672a5856788fe944b23e9851d3e0aaba.zip cpython-08de92a2672a5856788fe944b23e9851d3e0aaba.tar.gz cpython-08de92a2672a5856788fe944b23e9851d3e0aaba.tar.bz2 |
Re-enable GC of generator objects.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index dc00e42..ec62350 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -100,14 +100,14 @@ typedef struct { static PyObject * gen_new(PyFrameObject *f) { - genobject *gen = PyObject_New(genobject, &gentype); + genobject *gen = PyObject_GC_New(genobject, &gentype); if (gen == NULL) { Py_DECREF(f); return NULL; } gen->gi_frame = f; gen->gi_running = 0; - PyObject_GC_Init(gen); + _PyObject_GC_TRACK(gen); return (PyObject *)gen; } @@ -120,9 +120,9 @@ gen_traverse(genobject *gen, visitproc visit, void *arg) static void gen_dealloc(genobject *gen) { - PyObject_GC_Fini(gen); + _PyObject_GC_UNTRACK(gen); Py_DECREF(gen->gi_frame); - PyObject_Del(gen); + PyObject_GC_Del(gen); } static PyObject * @@ -204,7 +204,7 @@ statichere PyTypeObject gentype = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "generator", /* tp_name */ - sizeof(genobject) + PyGC_HEAD_SIZE, /* tp_basicsize */ + sizeof(genobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)gen_dealloc, /* tp_dealloc */ @@ -222,7 +222,7 @@ statichere PyTypeObject gentype = { 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)gen_traverse, /* tp_traverse */ 0, /* tp_clear */ |