summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/compile.c1
2 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 7c413d6..893b8ac 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 2?
Core and builtins
-----------------
+- The compilation of a class nested in another class used to leak one
+ reference on the outer class name.
+
- Patch #1810: compile() can now compile _ast trees as returned by
compile(..., PyCF_ONLY_AST).
diff --git a/Python/compile.c b/Python/compile.c
index 4f55b36..ae1f0da 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1431,6 +1431,7 @@ compiler_class(struct compiler *c, stmt_ty s)
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__");