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/2004-August/047320.html below:

[Python-Dev] new failing test -- test_compiler

[Python-Dev] new failing test -- test_compilerArmin Rigo arigo at tunes.org
Sun Aug 8 00:23:57 CEST 2004
Hi,

On Sat, Aug 07, 2004 at 09:47:22PM +0100, Michael Hudson wrote:
>         k = ''
>         for node in nodelist:
>             k += self.decode_literal(node[1])
> 
> what does this make you think of?  Yes, it's the new += string
> optimizations; Python gets upset if you mutate interned strings...
> 
> Armin is on the case...

Ahem, oups, yes, I am to blame for this memory corruption bug.  In the +=
string optimization I forgot that the string's ob_refcnt field is not always
"correct".  String interning messes with its value.  What occurred here is
that we mutated a string which had only one reference left -- that is, one
apart from the two that stringobject.c artificially removes to ob_refcnt when
interning.

This is now fixed by skipping the optimization if we got an interned string.  
While messing with ob_refcnt is always a bit fragile I am still convinced that
the += optimization is safe again.


A bientôt,

Armin.
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