summaryrefslogtreecommitdiffstats
path: root/Objects/funcobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-02-26 12:28:57 (GMT)
committerGeorg Brandl <georg@python.org>2007-02-26 12:28:57 (GMT)
commit80b331cb3080c9d9b28960f5e55475e3941ccdf6 (patch)
treeb69ba5c60910145a81115929fe6b0b0eb13c9891 /Objects/funcobject.c
parent257d3d93caa1c5e8320ae1960e0d81e58a7b90c0 (diff)
downloadcpython-80b331cb3080c9d9b28960f5e55475e3941ccdf6.zip
cpython-80b331cb3080c9d9b28960f5e55475e3941ccdf6.tar.gz
cpython-80b331cb3080c9d9b28960f5e55475e3941ccdf6.tar.bz2
Fix refleaks in function objects caused by kwdefaults not being allocated.
Should func_new be extended to support a "kwdefaults" arg?
Diffstat (limited to 'Objects/funcobject.c')
-rw-r--r--Objects/funcobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 956cbbc..d835f89 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -413,7 +413,7 @@ func_set_kwdefaults(PyFunctionObject *op, PyObject *value)
if (value == Py_None)
value = NULL;
- /* Legal to del f.func_defaults.
+ /* Legal to del f.func_kwdefaults.
* Can only set func_kwdefaults to NULL or a dict. */
if (value != NULL && !PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
@@ -587,6 +587,7 @@ func_dealloc(PyFunctionObject *op)
Py_XDECREF(op->func_module);
Py_DECREF(op->func_name);
Py_XDECREF(op->func_defaults);
+ Py_XDECREF(op->func_kwdefaults);
Py_XDECREF(op->func_doc);
Py_XDECREF(op->func_dict);
Py_XDECREF(op->func_closure);
@@ -609,6 +610,7 @@ func_traverse(PyFunctionObject *f, visitproc visit, void *arg)
Py_VISIT(f->func_globals);
Py_VISIT(f->func_module);
Py_VISIT(f->func_defaults);
+ Py_VISIT(f->func_kwdefaults);
Py_VISIT(f->func_doc);
Py_VISIT(f->func_name);
Py_VISIT(f->func_dict);