From a52e8fe49a625d13d89967bc17adeb71520bf3d0 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Thu, 1 Mar 2001 06:06:37 +0000 Subject: [PATCH] Visit the closure during traversal and XDECREF it on during deallocation. --- Objects/funcobject.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 0282242f4d..8871e0ac1f 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; } -- 2.50.0