[Python-3000-checkins] r53933 - python/branches/p3yk/Objects/funcobject.c

georg.brandl python-3000-checkins at python.org
Mon Feb 26 13:29:00 CET 2007


Author: georg.brandl
Date: Mon Feb 26 13:28:57 2007
New Revision: 53933

Modified:
   python/branches/p3yk/Objects/funcobject.c
Log:
Fix refleaks in function objects caused by kwdefaults not being allocated.

Should func_new be extended to support a "kwdefaults" arg?



Modified: python/branches/p3yk/Objects/funcobject.c
==============================================================================
--- python/branches/p3yk/Objects/funcobject.c	(original)
+++ python/branches/p3yk/Objects/funcobject.c	Mon Feb 26 13:28:57 2007
@@ -413,7 +413,7 @@
 
 	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 @@
 	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 @@
 	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);


More information about the Python-3000-checkins mailing list