diff Python/compile.c @ 46171:c77cc23e394f 2.5

Fix a reference leak found by Georg, when compiling a class nested in another class. Test is run with "regrtest.py -R:: test_compile" Backport of r62015
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Fri, 28 Mar 2008 20:45:42 +0000
parents 8cbe0bd93c28
children 787b969d37f0
line wrap: on
line diff
--- a/Python/compile.c	Thu Mar 27 23:41:59 2008 +0000
+++ b/Python/compile.c	Fri Mar 28 20:45:42 2008 +0000
@@ -2061,6 +2061,7 @@
 	if (!compiler_enter_scope(c, s->v.ClassDef.name, (void *)s,
 				  s->lineno))
 		return 0;
+	Py_XDECREF(c->u->u_private);
 	c->u->u_private = s->v.ClassDef.name;
 	Py_INCREF(c->u->u_private);
 	str = PyString_InternFromString("__name__");