diff Python/compile.c @ 46170:3b994f74b100 legacy-trunk

Fix a reference leak found by Georg, when compiling a class nested in another class. Now "regrtest.py -R:: test_compile" is satisfied. Will backport.
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Fri, 28 Mar 2008 20:30:50 +0000
parents ca38f7a4b4c9
children 2ff88ae9850c
line wrap: on
line diff
--- a/Python/compile.c	Fri Mar 28 20:22:56 2008 +0000
+++ b/Python/compile.c	Fri Mar 28 20:30:50 2008 +0000
@@ -1431,6 +1431,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__");