]> granicus.if.org Git - python/commitdiff
Visit the closure during traversal and XDECREF it on during deallocation.
authorJeremy Hylton <jeremy@alum.mit.edu>
Thu, 1 Mar 2001 06:06:37 +0000 (06:06 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Thu, 1 Mar 2001 06:06:37 +0000 (06:06 +0000)
Objects/funcobject.c

index 0282242f4de5d5e55ec0fdee8fbfb04e5e418224..8871e0ac1fa35158ae32f3a997d818371c1bfa00 100644 (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;
 }