A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-March/078283.html below:

[Python-Dev] nested classes leaking in compiler

[Python-Dev] nested classes leaking in compiler [Python-Dev] nested classes leaking in compilerAmaury Forgeot d'Arc amauryfa at gmail.com
Fri Mar 28 18:46:29 CET 2008
On Fri, Mar 28, 2008 at 11:50 AM, Georg Brandl <g.brandl at gmx.net> wrote:
> While preparing the Python-AST compilation patch, I noticed that each
>  class nested in a class leaks one reference (2.5 and trunk).
>
>  It wasn't found by regrtest -R because it only happens on compiling,
>  and it seems that all snippets compiled during the tests as opposed to
>  on import didn't contain such a construct.
>
>  The AST generation stage is fine, the leak happens somehwere
>  after that (I suspect the symtable code). It would be nice if someone
>  who understands more about that code than I do could fix this.

The problem is actually in compile.c, in compiler_class():
Each compilation scope holds the name of the enclosing class (for
__name mangling).
In the case of nested classes, the inner scope is first initialized
with the outer class name, then replaced with the inner class name.
But a Py_XDECREF(c->u->u_private) is missing here...

I will submit the correction in a few hours.

-- 
Amaury Forgeot d'Arc
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4