summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-03-01 06:06:37 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-03-01 06:06:37 (GMT)
commita52e8fe49a625d13d89967bc17adeb71520bf3d0 (patch)
tree7d17cebb6b865824c6bfbf4552c46c12281aa3da /Objects
parentbaee0d42c91801748790e1c5097428f48a424f44 (diff)
downloadcpython-a52e8fe49a625d13d89967bc17adeb71520bf3d0.zip
cpython-a52e8fe49a625d13d89967bc17adeb71520bf3d0.tar.gz
cpython-a52e8fe49a625d13d89967bc17adeb71520bf3d0.tar.bz2
Visit the closure during traversal and XDECREF it on during deallocation.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/funcobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 0282242..8871e0a 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -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;
}