Visit the closure during traversal and XDECREF it on during deallocation.

This commit is contained in:
Jeremy Hylton 2001-03-01 06:06:37 +00:00
parent baee0d42c9
commit a52e8fe49a
1 changed files with 6 additions and 0 deletions

View File

@ -252,6 +252,7 @@ func_dealloc(PyFunctionObject *op)
Py_XDECREF(op->func_defaults);
Py_XDECREF(op->func_doc);
Py_XDECREF(op->func_dict);
Py_XDECREF(op->func_closure);
op = (PyFunctionObject *) PyObject_AS_GC(op);
PyObject_DEL(op);
}
@ -303,6 +304,11 @@ func_traverse(PyFunctionObject *f, visitproc visit, void *arg)
if (err)
return err;
}
if (f->func_closure) {
err = visit(f->func_closure, arg);
if (err)
return err;
}
return 0;
}