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
This commit is contained in:
Amaury Forgeot d'Arc 2008-03-28 20:45:42 +00:00
parent 198e353735
commit 8432d86b9f
3 changed files with 8 additions and 0 deletions

View file

@ -2061,6 +2061,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__");