final patches from Neil Schemenauer for garbage collection

This commit is contained in:
Jeremy Hylton 2000-06-30 05:02:53 +00:00
parent 4e542a3d99
commit c5007aa5c3
16 changed files with 956 additions and 18 deletions

View file

@ -63,6 +63,7 @@ PyFunction_New(code, globals)
Py_INCREF(doc);
op->func_doc = doc;
}
PyObject_GC_Init(op);
return (PyObject *)op;
}
@ -186,6 +187,7 @@ static void
func_dealloc(op)
PyFunctionObject *op;
{
PyObject_GC_Fini(op);
Py_DECREF(op->func_code);
Py_DECREF(op->func_globals);
Py_DECREF(op->func_name);
@ -277,7 +279,7 @@ PyTypeObject PyFunction_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
"function",
sizeof(PyFunctionObject) + PyGC_INFO_SIZE,
sizeof(PyFunctionObject) + PyGC_HEAD_SIZE,
0,
(destructor)func_dealloc, /*tp_dealloc*/
0, /*tp_print*/