[Python-3000-checkins] r54502 - python/branches/p3yk/Python/compile.c

guido.van.rossum python-3000-checkins at python.org
Wed Mar 21 22:27:03 CET 2007


Author: guido.van.rossum
Date: Wed Mar 21 22:26:58 2007
New Revision: 54502

Modified:
   python/branches/p3yk/Python/compile.c
Log:
Fix refleak in compiler.
(A symbol table entry was leaked every time a class was compiled.)


Modified: python/branches/p3yk/Python/compile.c
==============================================================================
--- python/branches/p3yk/Python/compile.c	(original)
+++ python/branches/p3yk/Python/compile.c	Wed Mar 21 22:26:58 2007
@@ -1519,6 +1519,7 @@
 	PyCodeObject *co;
 	PyObject *str;
 	PySTEntryObject *ste;
+	int err;
 
 	/* initialize statics */
 	if (build_class == NULL) {
@@ -1547,7 +1548,9 @@
 	if (ste == NULL)
 		return 0;
 	assert(PyList_Check(ste->ste_varnames));
-	if (PyList_Append(ste->ste_varnames, locals) < 0)
+	err = PyList_Append(ste->ste_varnames, locals);
+	Py_DECREF(ste);
+	if (err < 0)
 		return 0;
 
 	/* 1. compile the class body into a code object */


More information about the Python-3000-checkins mailing list