mirror of https://github.com/python/cpython
Visit the closure during traversal and XDECREF it on during deallocation.
This commit is contained in:
parent
baee0d42c9
commit
a52e8fe49a
|
@ -252,6 +252,7 @@ func_dealloc(PyFunctionObject *op)
|
||||||
Py_XDECREF(op->func_defaults);
|
Py_XDECREF(op->func_defaults);
|
||||||
Py_XDECREF(op->func_doc);
|
Py_XDECREF(op->func_doc);
|
||||||
Py_XDECREF(op->func_dict);
|
Py_XDECREF(op->func_dict);
|
||||||
|
Py_XDECREF(op->func_closure);
|
||||||
op = (PyFunctionObject *) PyObject_AS_GC(op);
|
op = (PyFunctionObject *) PyObject_AS_GC(op);
|
||||||
PyObject_DEL(op);
|
PyObject_DEL(op);
|
||||||
}
|
}
|
||||||
|
@ -303,6 +304,11 @@ func_traverse(PyFunctionObject *f, visitproc visit, void *arg)
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
if (f->func_closure) {
|
||||||
|
err = visit(f->func_closure, arg);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue