[Python-Dev] interning
Oren Tirosh
oren-py-d@hishome.net
Sat, 10 Aug 2002 06:15:25 -0400
On Fri, Aug 09, 2002 at 02:03:10PM -0400, Guido van Rossum wrote:
> This means a change in the string object lay-out, which breaks binary
> compatibility (the PyString_AS_STRING macro depends on this).
I think that making interned string mortal is important enough by
itself even without the size reduction. If binary compatibility is
important enough it's possible to maintain it.
> I don't mind biting this bullet, but it means we have to increment the
> API version, and perhaps the warning about API version mismatches
> should become an error if an extension with too an API version before
> this change is detected.
>
> Oren, how's that patch coming along? :-)
I've just submitted a new patch for http://python.org/sf/576101
It passes regrtest but causes test_gc to leak 20 objects. 13 from
test_finalizer_newclass and 7 from test_del_newclass. These leaks
go away if test_saveall is skipped. I've tried earlier versions of
this patch (which were ok at the time) and they now create this
leak too.
Some change since the last time I worked on interning must have
caused this. Either this change reveals a bug in my patch or my patch
reveals a subtle bug in the GC.
I don't know why it interacts with GC logic because strings are
non-gc objects. I've tried to untrack the interned dictionary because
it plays dirty tricks with refcounts but it doesn't change the
symptom.
Oren