[Python-3000] refleaks

Amaury Forgeot d'Arc amauryfa at gmail.com
Tue Apr 1 09:58:47 CEST 2008


On Tue, Apr 1, 2008 at 9:41 AM, Neal Norwitz <nnorwitz at gmail.com> wrote:
> I fixed the itertools refleak.
>
>  test_compile leaks due to code like this:
>
>  class J:
>   def foo():
>     class Bar: pass
>
>  I thought Amaury fixed that problem already?

http://mail.python.org/pipermail/python-3000-checkins/2008-March/003205.html
says:
> Blocked revisions 62015 via svnmerge
> This was apparently fixed in r54428 already

Which is not exact; the lines in compile.c (around line 1552)

		/* use the class name for name mangling */
		Py_INCREF(s->v.ClassDef.name);
		c->u->u_private = s->v.ClassDef.name;
should be changed to
		/* use the class name for name mangling */
		Py_INCREF(s->v.ClassDef.name);
		Py_XDECREF(c->u->u_private);
		c->u->u_private = s->v.ClassDef.name;

I agree that the merge was complicated: compile.c changed a lot during r54428.
Maybe an argument in favor of the MYOC pattern?
("Merge Your Own Code":
http://www.cmcrossroads.com/bradapp/acme/branching/branch-policy.html#MYOC
)

-- 
Amaury Forgeot d'Arc


More information about the Python-3000 mailing list