summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-08-29 23:54:21 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-08-29 23:54:21 (GMT)
commite83c00efd06dc8380d481f6c5f92d8c274ce6bd2 (patch)
treee3fb442318523f476d521d42826a90f8476b7f6d /Objects/funcobject.c
parentfd34369ecb5d66e865f212c65926579bf81cf7a5 (diff)
downloadcpython-e83c00efd06dc8380d481f6c5f92d8c274ce6bd2.zip
cpython-e83c00efd06dc8380d481f6c5f92d8c274ce6bd2.tar.gz
cpython-e83c00efd06dc8380d481f6c5f92d8c274ce6bd2.tar.bz2
Use new GC API.
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 6f56bf6..57d02fe 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -9,7 +9,7 @@
PyObject *
PyFunction_New(PyObject *code, PyObject *globals)
{
- PyFunctionObject *op = PyObject_NEW(PyFunctionObject,
+ PyFunctionObject *op = PyObject_GC_New(PyFunctionObject,
&PyFunction_Type);
if (op != NULL) {
PyObject *doc;
@@ -37,7 +37,7 @@ PyFunction_New(PyObject *code, PyObject *globals)
}
else
return NULL;
- PyObject_GC_Init(op);
+ _PyObject_GC_TRACK(op);
return (PyObject *)op;
}
@@ -223,8 +223,8 @@ func_setattro(PyObject *op, PyObject *name, PyObject *value)
static void
func_dealloc(PyFunctionObject *op)
{
+ _PyObject_GC_UNTRACK(op);
PyObject_ClearWeakRefs((PyObject *) op);
- PyObject_GC_Fini(op);
Py_DECREF(op->func_code);
Py_DECREF(op->func_globals);
Py_DECREF(op->func_name);
@@ -232,8 +232,7 @@ func_dealloc(PyFunctionObject *op)
Py_XDECREF(op->func_doc);
Py_XDECREF(op->func_dict);
Py_XDECREF(op->func_closure);
- op = (PyFunctionObject *) PyObject_AS_GC(op);
- PyObject_DEL(op);
+ PyObject_GC_Del(op);
}
static PyObject*
@@ -352,7 +351,7 @@ PyTypeObject PyFunction_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
"function",
- sizeof(PyFunctionObject) + PyGC_HEAD_SIZE,
+ sizeof(PyFunctionObject),
0,
(destructor)func_dealloc, /* tp_dealloc */
0, /* tp_print */
@@ -369,7 +368,7 @@ PyTypeObject PyFunction_Type = {
func_getattro, /* tp_getattro */
func_setattro, /* 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)func_traverse, /* tp_traverse */
0, /* tp_clear */